import {Role} from "@/interfaces/entity"; import client from "@/lib/mongodb"; const db = client.db(process.env.MONGODB_DB); export const getRolesByEntities = async (entityIDs: string[]) => await db .collection("roles") .find({entityID: {$in: entityIDs}}) .toArray(); export const getRolesByEntity = async (entityID: string) => await db.collection("roles").find({entityID}).toArray(); export const getRole = async (id: string) => (await db.collection("roles").findOne({id})) ?? undefined;