1
0
Fork 0
peertube/server/middlewares/sort.js
2017-01-04 21:05:13 +01:00

29 lines
557 B
JavaScript

'use strict'
const sortMiddleware = {
setUsersSort,
setVideoAbusesSort,
setVideosSort
}
function setUsersSort (req, res, next) {
if (!req.query.sort) req.query.sort = '-createdAt'
return next()
}
function setVideoAbusesSort (req, res, next) {
if (!req.query.sort) req.query.sort = '-createdAt'
return next()
}
function setVideosSort (req, res, next) {
if (!req.query.sort) req.query.sort = '-createdAt'
return next()
}
// ---------------------------------------------------------------------------
module.exports = sortMiddleware