PeerTube/server/middlewares/sort.ts
2017-06-10 22:15:25 +02:00

29 lines
728 B
TypeScript

import 'express-validator'
import * as express from 'express'
function setUsersSort (req: express.Request, res: express.Response, next: express.NextFunction) {
if (!req.query.sort) req.query.sort = '-createdAt'
return next()
}
function setVideoAbusesSort (req: express.Request, res: express.Response, next: express.NextFunction) {
if (!req.query.sort) req.query.sort = '-createdAt'
return next()
}
function setVideosSort (req: express.Request, res: express.Response, next: express.NextFunction) {
if (!req.query.sort) req.query.sort = '-createdAt'
return next()
}
// ---------------------------------------------------------------------------
export {
setUsersSort,
setVideoAbusesSort,
setVideosSort
}