]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/middlewares/validators/pagination.ts
Remove ng2-completer
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / pagination.ts
CommitLineData
69818c93
C
1import 'express-validator'
2import * as express from 'express'
3
65fcc311
C
4import { checkErrors } from './utils'
5import { logger } from '../../helpers'
fbf1134e 6
69818c93 7function 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
18export {
19 paginationValidator
20}