PeerTube/server/middlewares/sort.js

23 lines
448 B
JavaScript
Raw Normal View History

2016-05-17 14:03:00 -05:00
'use strict'
const sortMiddleware = {
2016-08-16 15:31:45 -05:00
setUsersSort: setUsersSort,
2016-05-17 14:03:00 -05:00
setVideosSort: setVideosSort
}
2016-08-16 15:31:45 -05:00
function setUsersSort (req, res, next) {
if (!req.query.sort) req.query.sort = '-createdDate'
return next()
}
2016-05-17 14:03:00 -05:00
function setVideosSort (req, res, next) {
if (!req.query.sort) req.query.sort = '-createdDate'
return next()
}
// ---------------------------------------------------------------------------
module.exports = sortMiddleware