1
0
mirror of https://framagit.org/framasoft/peertube/search-index/ synced 2025-01-10 08:32:41 +01:00
sepia-search-motore-di-rice.../server/middlewares/validators/pagination.ts
2020-05-29 16:16:55 +02:00

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
}