aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/sort.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/sort.ts')
-rw-r--r--server/middlewares/sort.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/server/middlewares/sort.ts b/server/middlewares/sort.ts
index 687ce097b..2c70ff5f0 100644
--- a/server/middlewares/sort.ts
+++ b/server/middlewares/sort.ts
@@ -4,6 +4,12 @@ import * as express from 'express'
4import { SortType } from '../helpers' 4import { SortType } from '../helpers'
5import { database } from '../initializers' 5import { database } from '../initializers'
6 6
7function setPodsSort (req: express.Request, res: express.Response, next: express.NextFunction) {
8 if (!req.query.sort) req.query.sort = '-createdAt'
9
10 return next()
11}
12
7function setUsersSort (req: express.Request, res: express.Response, next: express.NextFunction) { 13function setUsersSort (req: express.Request, res: express.Response, next: express.NextFunction) {
8 if (!req.query.sort) req.query.sort = '-createdAt' 14 if (!req.query.sort) req.query.sort = '-createdAt'
9 15
@@ -46,6 +52,7 @@ function setBlacklistSort (req: express.Request, res: express.Response, next: ex
46// --------------------------------------------------------------------------- 52// ---------------------------------------------------------------------------
47 53
48export { 54export {
55 setPodsSort,
49 setUsersSort, 56 setUsersSort,
50 setVideoAbusesSort, 57 setVideoAbusesSort,
51 setVideosSort, 58 setVideosSort,