Continued creating the entity system
This commit is contained in:
12
src/utils/stats.be.ts
Normal file
12
src/utils/stats.be.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import {Stat} from "@/interfaces/user";
|
||||
import client from "@/lib/mongodb";
|
||||
|
||||
const db = client.db(process.env.MONGODB_DB);
|
||||
|
||||
export const getStatsByUser = async (id: string) => await db.collection("stats").find<Stat>({user: id}).toArray();
|
||||
|
||||
export const getStatsByUsers = async (ids: string[]) =>
|
||||
await db
|
||||
.collection("stats")
|
||||
.find<Stat>({user: {$in: ids}})
|
||||
.toArray();
|
||||
Reference in New Issue
Block a user