]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/validators/sort.js
Server: migration script that add admin role to root user
[github/Chocobozzz/PeerTube.git] / server / middlewares / validators / sort.js
index 56b63cc8b9ddaffd5c5e1304ec4c0c38683382da..37b34ef52cbca232c0153459640a10d88817f1d3 100644 (file)
@@ -5,9 +5,20 @@ const constants = require('../../initializers/constants')
 const logger = require('../../helpers/logger')
 
 const validatorsSort = {
+  usersSort: usersSort,
   videosSort: videosSort
 }
 
+function usersSort (req, res, next) {
+  const sortableColumns = constants.SORTABLE_COLUMNS.USERS
+
+  req.checkQuery('sort', 'Should have correct sortable column').optional().isIn(sortableColumns)
+
+  logger.debug('Checking sort parameters', { parameters: req.query })
+
+  checkErrors(req, res, next)
+}
+
 function videosSort (req, res, next) {
   const sortableColumns = constants.SORTABLE_COLUMNS.VIDEOS