useUsers refactor

This commit is contained in:
Carlos Mesquita
2024-09-08 09:37:19 +01:00
parent 898edb152f
commit 4282c1d021
6 changed files with 29 additions and 23 deletions

View File

@@ -25,17 +25,20 @@ export async function getSpecificUsers(ids: string[]) {
.toArray();
}
type Query = { [key: string]: string | string[] | undefined };
export async function getLinkedUsers(
userID?: string,
userType?: Type,
type?: Type,
query?: Query,
page?: number,
size?: number,
sort?: string,
direction?: "asc" | "desc",
) {
const filters = {
...(!!type ? {type} : {}),
...(!!query ? query : {}),
};
if (!userID || userType === "admin" || userType === "developer") {