]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/middlewares/validators/pagination.ts
Fix lint
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / pagination.ts
CommitLineData
b60e5f38 1import { query } from 'express-validator/check'
69818c93
C
2import * as express from 'express'
3
65fcc311
C
4import { checkErrors } from './utils'
5import { logger } from '../../helpers'
fbf1134e 6
b60e5f38
C
7const paginationValidator = [
8 query('start').optional().isInt().withMessage('Should have a number start'),
9 query('count').optional().isInt().withMessage('Should have a number count'),
fbf1134e 10
b60e5f38
C
11 (req: express.Request, res: express.Response, next: express.NextFunction) => {
12 logger.debug('Checking pagination parameters', { parameters: req.query })
fbf1134e 13
b60e5f38
C
14 checkErrors(req, res, next)
15 }
16]
fbf1134e
C
17
18// ---------------------------------------------------------------------------
19
65fcc311
C
20export {
21 paginationValidator
22}