fix: Server error when invalid 'sort' field is passed from an API client (#2000)
This commit is contained in:
@ -18,6 +18,12 @@ export default function validation() {
|
||||
}
|
||||
};
|
||||
|
||||
ctx.assertSort = (value, model, message = "Invalid sort parameter") => {
|
||||
if (!Object.keys(model.rawAttributes).includes(value)) {
|
||||
throw new ValidationError(message);
|
||||
}
|
||||
};
|
||||
|
||||
ctx.assertNotEmpty = (value, message) => {
|
||||
if (value === "") {
|
||||
throw new ValidationError(message);
|
||||
|
Reference in New Issue
Block a user