1
0
Fork 0
peertube/server/middlewares/sort.ts

29 lines
728 B
TypeScript
Raw Normal View History

2017-06-10 16:15:25 -04:00
import 'express-validator'
import * as express from 'express'
function setUsersSort (req: express.Request, res: express.Response, next: express.NextFunction) {
2016-12-11 15:50:51 -05:00
if (!req.query.sort) req.query.sort = '-createdAt'
2016-08-16 16:31:45 -04:00
return next()
}
2017-06-10 16:15:25 -04:00
function setVideoAbusesSort (req: express.Request, res: express.Response, next: express.NextFunction) {
2017-01-04 14:59:23 -05:00
if (!req.query.sort) req.query.sort = '-createdAt'
return next()
}
2017-06-10 16:15:25 -04:00
function setVideosSort (req: express.Request, res: express.Response, next: express.NextFunction) {
2016-12-11 15:50:51 -05:00
if (!req.query.sort) req.query.sort = '-createdAt'
2016-05-17 15:03:00 -04:00
return next()
}
// ---------------------------------------------------------------------------
2017-05-15 16:22:03 -04:00
export {
setUsersSort,
setVideoAbusesSort,
setVideosSort
}