PeerTube/server/middlewares/validators/pagination.ts

21 lines
620 B
TypeScript
Raw Normal View History

2017-06-10 22:15:25 +02:00
import 'express-validator'
import * as express from 'express'
2017-05-15 22:22:03 +02:00
import { checkErrors } from './utils'
import { logger } from '../../helpers'
2017-06-10 22:15:25 +02:00
function paginationValidator (req: express.Request, res: express.Response, next: express.NextFunction) {
2016-05-17 21:03:00 +02:00
req.checkQuery('start', 'Should have a number start').optional().isInt()
req.checkQuery('count', 'Should have a number count').optional().isInt()
2016-05-17 21:03:00 +02:00
logger.debug('Checking pagination parameters', { parameters: req.query })
checkErrors(req, res, next)
}
// ---------------------------------------------------------------------------
2017-05-15 22:22:03 +02:00
export {
paginationValidator
}