PeerTube/server/middlewares/sort.js

23 lines
419 B
JavaScript
Raw Normal View History

2016-05-17 21:03:00 +02:00
'use strict'
const sortMiddleware = {
setUsersSort,
setVideosSort
2016-05-17 21:03:00 +02:00
}
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