diff --git a/src/utils/groups.be.ts b/src/utils/groups.be.ts index 699f11d6..42fe68f9 100644 --- a/src/utils/groups.be.ts +++ b/src/utils/groups.be.ts @@ -64,7 +64,10 @@ export const getUserNamedGroup = async (id: string, name: string) => { }; export const getUsersGroups = async (ids: string[]) => { - return await db.collection("groups").find({admin: ids}).toArray(); + return await db + .collection("groups") + .find({admin: {$in: ids}}) + .toArray(); }; export const getAllAssignersByCorporate = async (corporateID: string): Promise => { diff --git a/src/utils/users.be.ts b/src/utils/users.be.ts index a04bfd20..cd5c1c1a 100644 --- a/src/utils/users.be.ts +++ b/src/utils/users.be.ts @@ -56,7 +56,7 @@ export async function getLinkedUsers( const participants = uniq([ ...adminGroups.flatMap((x) => x.participants), - ...groups.flat().flatMap((x) => x.participants), + ...(userType === "mastercorporate" ? groups.flat().flatMap((x) => x.participants) : []), ...(userType === "teacher" ? belongingGroups.flatMap((x) => x.participants) : []), ]);