fix: Server error when invalid 'sort' field is passed from an API client (#2000)
This commit is contained in:
@ -18,9 +18,10 @@ const { authorize } = policy;
|
||||
const router = new Router();
|
||||
|
||||
router.post("groups.list", auth(), pagination(), async (ctx) => {
|
||||
const { sort = "updatedAt" } = ctx.body;
|
||||
let direction = ctx.body.direction;
|
||||
let { sort = "updatedAt", direction } = ctx.body;
|
||||
if (direction !== "ASC") direction = "DESC";
|
||||
ctx.assertSort(sort, Group);
|
||||
|
||||
const user = ctx.state.user;
|
||||
|
||||
let groups = await Group.findAll({
|
||||
|
Reference in New Issue
Block a user