Server: do not allow a user to remove a video of another user
[oweals/peertube.git] / server / middlewares / validators / sort.js
1 'use strict'
2
3 const checkErrors = require('./utils').checkErrors
4 const constants = require('../../initializers/constants')
5 const logger = require('../../helpers/logger')
6
7 const validatorsSort = {
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
23 module.exports = validatorsSort