import { CEFR_STEPS } from "@/resources/grading";
import { getUserCorporate } from "@/utils/groups.be";
import { User } from "@/interfaces/user";
import { Grading } from "@/interfaces";
import client from "@/lib/mongodb";

const db = client.db(process.env.MONGODB_DB);

export const getGradingSystemByEntity = async (id: string) =>
	(await db.collection("grading").findOne<Grading>({ entity: id })) || { steps: CEFR_STEPS, entity: "" };

export const getGradingSystemByEntities = async (ids: string[]) =>
	await db.collection("grading").find<Grading>({ entity: { $in: ids } }).toArray();
