diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-07-01 16:16:40 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-07-01 16:16:40 +0200 |
commit | fc51fde048f2c3ce1dd3e85f5528335040bae894 (patch) | |
tree | 6de1eeac1291d9398cc99cda926b189c39b3ea0b /server/middlewares/validators/sort.js | |
parent | 69b0a27cbbd69ca019eb7db5f917b1dd06dc82cd (diff) | |
download | PeerTube-fc51fde048f2c3ce1dd3e85f5528335040bae894.tar.gz PeerTube-fc51fde048f2c3ce1dd3e85f5528335040bae894.tar.zst PeerTube-fc51fde048f2c3ce1dd3e85f5528335040bae894.zip |
reqValidators --> validators
Diffstat (limited to 'server/middlewares/validators/sort.js')
-rw-r--r-- | server/middlewares/validators/sort.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/server/middlewares/validators/sort.js b/server/middlewares/validators/sort.js new file mode 100644 index 000000000..56b63cc8b --- /dev/null +++ b/server/middlewares/validators/sort.js | |||
@@ -0,0 +1,23 @@ | |||
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 | ||