diff options
Diffstat (limited to 'server/middlewares/validators/pagination.ts')
-rw-r--r-- | server/middlewares/validators/pagination.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/server/middlewares/validators/pagination.ts b/server/middlewares/validators/pagination.ts index a5a542cdf..0895b4eb8 100644 --- a/server/middlewares/validators/pagination.ts +++ b/server/middlewares/validators/pagination.ts | |||
@@ -1,8 +1,7 @@ | |||
1 | import { query } from 'express-validator/check' | ||
2 | import * as express from 'express' | 1 | import * as express from 'express' |
3 | 2 | import { query } from 'express-validator/check' | |
4 | import { checkErrors } from './utils' | ||
5 | import { logger } from '../../helpers' | 3 | import { logger } from '../../helpers' |
4 | import { areValidationErrors } from './utils' | ||
6 | 5 | ||
7 | const paginationValidator = [ | 6 | const paginationValidator = [ |
8 | query('start').optional().isInt().withMessage('Should have a number start'), | 7 | query('start').optional().isInt().withMessage('Should have a number start'), |
@@ -11,7 +10,9 @@ const paginationValidator = [ | |||
11 | (req: express.Request, res: express.Response, next: express.NextFunction) => { | 10 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
12 | logger.debug('Checking pagination parameters', { parameters: req.query }) | 11 | logger.debug('Checking pagination parameters', { parameters: req.query }) |
13 | 12 | ||
14 | checkErrors(req, res, next) | 13 | if (areValidationErrors(req, res)) return |
14 | |||
15 | return next() | ||
15 | } | 16 | } |
16 | ] | 17 | ] |
17 | 18 | ||