fix: users.info request flood (#3334)
* feat: Add user id filter to users.list endpoint * fix: Remove users.info request loop
This commit is contained in:
@@ -19,7 +19,7 @@ const router = new Router();
|
||||
|
||||
router.post("users.list", auth(), pagination(), async (ctx) => {
|
||||
let { direction } = ctx.body;
|
||||
const { sort = "createdAt", query, filter } = ctx.body;
|
||||
const { sort = "createdAt", query, filter, ids } = ctx.body;
|
||||
if (direction !== "ASC") {
|
||||
direction = "DESC";
|
||||
}
|
||||
@@ -88,6 +88,14 @@ router.post("users.list", auth(), pagination(), async (ctx) => {
|
||||
};
|
||||
}
|
||||
|
||||
if (ids) {
|
||||
assertArray(ids, "ids must be an array of UUIDs");
|
||||
where = {
|
||||
...where,
|
||||
id: ids,
|
||||
};
|
||||
}
|
||||
|
||||
const [users, total] = await Promise.all([
|
||||
User.findAll({
|
||||
where,
|
||||
|
||||
Reference in New Issue
Block a user