1 import * as express from 'express'
2 import { query } from 'express-validator'
3 import { logger } from '../../helpers/logger'
4 import { areValidationErrors } from './utils'
5 import { PAGINATION } from '@server/initializers/constants'
7 const paginationValidator = [
10 .isInt({ min: 0 }).withMessage('Should have a number start'),
13 .isInt({ min: 0, max: PAGINATION.GLOBAL.COUNT.MAX }).withMessage(`Should have a number count (max: ${PAGINATION.GLOBAL.COUNT.MAX})`),
15 (req: express.Request, res: express.Response, next: express.NextFunction) => {
16 logger.debug('Checking pagination parameters', { parameters: req.query })
18 if (areValidationErrors(req, res)) return
24 // ---------------------------------------------------------------------------