Updated the make_user to use MongoDB

This commit is contained in:
Tiago Ribeiro
2024-09-07 16:01:03 +01:00
parent 171231cd21
commit 238a25aaeb
2 changed files with 41 additions and 60 deletions

View File

@@ -44,6 +44,10 @@ export const getUserCorporate = async (id: string) => {
return corporates.shift() as CorporateUser | MasterCorporateUser;
};
export const getGroup = async (id: string) => {
return await db.collection("groups").findOne<Group>({id});
};
export const getGroups = async () => {
return await db.collection("groups").find<Group>({}).toArray();
};
@@ -56,6 +60,10 @@ export const getUserGroups = async (id: string): Promise<Group[]> => {
return await db.collection("groups").find<Group>({admin: id}).toArray();
};
export const getUserNamedGroup = async (id: string, name: string) => {
return await db.collection("groups").findOne<Group>({admin: id, name});
};
export const getUsersGroups = async (ids: string[]) => {
return await db
.collection("groups")