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