1
0
Fork 0
peertube/server/middlewares/validators/pagination.ts

21 lines
620 B
TypeScript
Raw Normal View History

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