1 import * as express from 'express'
2 import { query } from 'express-validator'
3 import { logger } from '../../../helpers/logger'
4 import { areValidationErrors } from '../utils'
6 const apPaginationValidator = [
7 query('page').optional().isInt({ min: 1 }).withMessage('Should have a valid page number'),
8 query('size').optional().isInt({ max: 50 }).withMessage('Should have a valid page size (max: 50)'),
10 (req: express.Request, res: express.Response, next: express.NextFunction) => {
11 logger.debug('Checking pagination parameters', { parameters: req.query })
13 if (areValidationErrors(req, res)) return
19 // ---------------------------------------------------------------------------