Started implementing the roles permissions

This commit is contained in:
Tiago Ribeiro
2024-10-10 19:13:18 +01:00
parent c43ab9a911
commit 55204e2ce1
67 changed files with 1357 additions and 1134 deletions

View File

@@ -46,16 +46,16 @@ export async function getSpecificUsers(ids: string[]) {
.toArray();
}
export async function getEntityUsers(id: string, limit?: number) {
export async function getEntityUsers(id: string, limit?: number, filter?: object) {
return await db
.collection("users")
.find<User>({ "entities.id": id })
.find<User>({ "entities.id": id, ...(filter || {}) })
.limit(limit || 0)
.toArray();
}
export async function countEntityUsers(id: string) {
return await db.collection("users").countDocuments({ "entities.id": id });
export async function countEntityUsers(id: string, filter?: object) {
return await db.collection("users").countDocuments({ "entities.id": id, ...(filter || {}) });
}
export async function getEntitiesUsers(ids: string[], filter?: object, limit?: number) {