Continued creating the entity system

This commit is contained in:
Tiago Ribeiro
2024-10-01 17:39:43 +01:00
parent bae02e5192
commit 564e6438cb
37 changed files with 2522 additions and 130 deletions

12
src/utils/stats.be.ts Normal file
View 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();