Started implementing the roles permissions
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user