Add role parameter to users.list endpoint (#6754)

This commit is contained in:
Tom Moor
2024-04-02 06:00:12 -06:00
committed by GitHub
parent d2d3adefe6
commit 365f4c4b1f
3 changed files with 39 additions and 1 deletions

View File

@@ -35,7 +35,8 @@ router.post(
pagination(),
validate(T.UsersListSchema),
async (ctx: APIContext<T.UsersListReq>) => {
const { sort, direction, query, filter, ids, emails } = ctx.input.body;
const { sort, direction, query, role, filter, ids, emails } =
ctx.input.body;
const actor = ctx.state.auth.user;
let where: WhereOptions<User> = {
@@ -113,6 +114,13 @@ router.post(
}
}
if (role) {
where = {
...where,
role,
};
}
if (query) {
where = {
...where,