diff options
Diffstat (limited to 'server/middlewares/validators/sort.ts')
-rw-r--r-- | server/middlewares/validators/sort.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/middlewares/validators/sort.ts b/server/middlewares/validators/sort.ts index 6fea41bb8..636f68885 100644 --- a/server/middlewares/validators/sort.ts +++ b/server/middlewares/validators/sort.ts | |||
@@ -1,9 +1,9 @@ | |||
1 | import { query } from 'express-validator/check' | 1 | import { query } from 'express-validator/check' |
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | 3 | ||
4 | import { checkErrors } from './utils' | ||
5 | import { logger } from '../../helpers' | 4 | import { logger } from '../../helpers' |
6 | import { SORTABLE_COLUMNS } from '../../initializers' | 5 | import { SORTABLE_COLUMNS } from '../../initializers' |
6 | import { areValidationErrors } from './utils' | ||
7 | 7 | ||
8 | // Initialize constants here for better performances | 8 | // Initialize constants here for better performances |
9 | const SORTABLE_USERS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.USERS) | 9 | const SORTABLE_USERS_COLUMNS = createSortableColumns(SORTABLE_COLUMNS.USERS) |
@@ -43,7 +43,9 @@ function checkSort (sortableColumns: string[]) { | |||
43 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 43 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
44 | logger.debug('Checking sort parameters', { parameters: req.query }) | 44 | logger.debug('Checking sort parameters', { parameters: req.query }) |
45 | 45 | ||
46 | checkErrors(req, res, next) | 46 | if (areValidationErrors(req, res)) return |
47 | |||
48 | return next() | ||
47 | } | 49 | } |
48 | ] | 50 | ] |
49 | } | 51 | } |