]>
Commit | Line | Data |
---|---|---|
a877d5ac C |
1 | 'use strict' |
2 | ||
3 | const checkErrors = require('./utils').checkErrors | |
4 | const constants = require('../../initializers/constants') | |
5 | const logger = require('../../helpers/logger') | |
6 | ||
fc51fde0 | 7 | const validatorsSort = { |
a877d5ac C |
8 | videosSort: videosSort |
9 | } | |
10 | ||
11 | function videosSort (req, res, next) { | |
12 | const sortableColumns = constants.SORTABLE_COLUMNS.VIDEOS | |
13 | ||
14 | req.checkQuery('sort', 'Should have correct sortable column').optional().isIn(sortableColumns) | |
15 | ||
16 | logger.debug('Checking sort parameters', { parameters: req.query }) | |
17 | ||
18 | checkErrors(req, res, next) | |
19 | } | |
20 | ||
21 | // --------------------------------------------------------------------------- | |
22 | ||
fc51fde0 | 23 | module.exports = validatorsSort |