2016-05-13 12:10:46 -04:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const checkErrors = require('./utils').checkErrors
|
|
|
|
const logger = require('../../helpers/logger')
|
|
|
|
|
2016-07-01 10:16:40 -04:00
|
|
|
const validatorsPagination = {
|
2016-10-02 06:19:02 -04:00
|
|
|
pagination
|
2016-05-13 12:10:46 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function pagination (req, res, next) {
|
2016-05-17 15:03:00 -04:00
|
|
|
req.checkQuery('start', 'Should have a number start').optional().isInt()
|
|
|
|
req.checkQuery('count', 'Should have a number count').optional().isInt()
|
2016-05-13 12:10:46 -04:00
|
|
|
|
2016-05-17 15:03:00 -04:00
|
|
|
logger.debug('Checking pagination parameters', { parameters: req.query })
|
2016-05-13 12:10:46 -04:00
|
|
|
|
|
|
|
checkErrors(req, res, next)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
2016-07-01 10:16:40 -04:00
|
|
|
module.exports = validatorsPagination
|