PeerTube/server/middlewares/sort.js
2016-08-16 22:31:45 +02:00

23 lines
448 B
JavaScript

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