Add role parameter to users.list endpoint (#6754)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user