aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/pagination.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/pagination.ts')
-rw-r--r--server/middlewares/validators/pagination.ts9
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 @@
1import { query } from 'express-validator/check'
2import * as express from 'express' 1import * as express from 'express'
3 2import { query } from 'express-validator/check'
4import { checkErrors } from './utils'
5import { logger } from '../../helpers' 3import { logger } from '../../helpers'
4import { areValidationErrors } from './utils'
6 5
7const paginationValidator = [ 6const 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