PeerTube/server/middlewares/sort.js

23 lines
415 B
JavaScript

'use strict'
const sortMiddleware = {
setUsersSort,
setVideosSort
}
function setUsersSort (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