1
0
Fork 0
peertube/server/middlewares/reqValidators/sort.js

24 lines
644 B
JavaScript
Raw Normal View History

2016-05-17 15:03:00 -04:00
'use strict'
const checkErrors = require('./utils').checkErrors
const constants = require('../../initializers/constants')
const logger = require('../../helpers/logger')
const reqValidatorsSort = {
videosSort: videosSort
}
function videosSort (req, res, next) {
const sortableColumns = constants.SORTABLE_COLUMNS.VIDEOS
req.checkQuery('sort', 'Should have correct sortable column').optional().isIn(sortableColumns)
logger.debug('Checking sort parameters', { parameters: req.query })
checkErrors(req, res, next)
}
// ---------------------------------------------------------------------------
module.exports = reqValidatorsSort