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();
