]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/middlewares/validators/pagination.ts
Type functions
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / pagination.ts
1 import 'express-validator'
2 import * as express from 'express'
3
4 import { checkErrors } from './utils'
5 import { logger } from '../../helpers'
6
7 function paginationValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
8 req.checkQuery('start', 'Should have a number start').optional().isInt()
9 req.checkQuery('count', 'Should have a number count').optional().isInt()
10
11 logger.debug('Checking pagination parameters', { parameters: req.query })
12
13 checkErrors(req, res, next)
14 }
15
16 // ---------------------------------------------------------------------------
17
18 export {
19 paginationValidator
20 }