]>
Commit | Line | Data |
---|---|---|
b60e5f38 | 1 | import { query } from 'express-validator/check' |
69818c93 C |
2 | import * as express from 'express' |
3 | ||
65fcc311 C |
4 | import { checkErrors } from './utils' |
5 | import { logger } from '../../helpers' | |
fbf1134e | 6 | |
b60e5f38 C |
7 | const paginationValidator = [ |
8 | query('start').optional().isInt().withMessage('Should have a number start'), | |
9 | query('count').optional().isInt().withMessage('Should have a number count'), | |
fbf1134e | 10 | |
b60e5f38 C |
11 | (req: express.Request, res: express.Response, next: express.NextFunction) => { |
12 | logger.debug('Checking pagination parameters', { parameters: req.query }) | |
fbf1134e | 13 | |
b60e5f38 C |
14 | checkErrors(req, res, next) |
15 | } | |
16 | ] | |
fbf1134e C |
17 | |
18 | // --------------------------------------------------------------------------- | |
19 | ||
65fcc311 C |
20 | export { |
21 | paginationValidator | |
22 | } |