aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/middlewares/validators/pagination.ts
blob: de719c05bc42fd7f80c2a414332205c535655e5d (plain) (tree)
1
2
3
4
5
6
7
8

                                      
 
                                               

                                                                          
 
                                                                           





                                                                              


                     
import { checkErrors } from './utils'
import { logger } from '../../helpers'

function paginationValidator (req, res, next) {
  req.checkQuery('start', 'Should have a number start').optional().isInt()
  req.checkQuery('count', 'Should have a number count').optional().isInt()

  logger.debug('Checking pagination parameters', { parameters: req.query })

  checkErrors(req, res, next)
}

// ---------------------------------------------------------------------------

export {
  paginationValidator
}