PeerTube/server/middlewares/sort.js

23 lines
448 B
JavaScript
Raw Normal View History

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