mirror of
https://framagit.org/framasoft/peertube/search-index/
synced 2025-01-10 16:42:36 +01:00
21 lines
599 B
TypeScript
21 lines
599 B
TypeScript
import * as express from 'express'
|
|
import { check } from 'express-validator'
|
|
import { areValidationErrors } from './utils'
|
|
|
|
const paginationValidator = [
|
|
check('start').optional().isInt({ min: 0 }).withMessage('Should have a number start'),
|
|
check('count').optional().isInt({ min: 0 }).withMessage('Should have a number count'),
|
|
|
|
(req: express.Request, res: express.Response, next: express.NextFunction) => {
|
|
if (areValidationErrors(req, res)) return
|
|
|
|
return next()
|
|
}
|
|
]
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export {
|
|
paginationValidator
|
|
}
|