diff options
Diffstat (limited to 'server/middlewares/sort.ts')
-rw-r--r-- | server/middlewares/sort.ts | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/server/middlewares/sort.ts b/server/middlewares/sort.ts index 91aa3e5b6..20ae341f0 100644 --- a/server/middlewares/sort.ts +++ b/server/middlewares/sort.ts | |||
@@ -34,6 +34,18 @@ function setVideosSort (req: express.Request, res: express.Response, next: expre | |||
34 | return next() | 34 | return next() |
35 | } | 35 | } |
36 | 36 | ||
37 | function setFollowersSort (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
38 | if (!req.query.sort) req.query.sort = '-createdAt' | ||
39 | |||
40 | return next() | ||
41 | } | ||
42 | |||
43 | function setFollowingSort (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
44 | if (!req.query.sort) req.query.sort = '-createdAt' | ||
45 | |||
46 | return next() | ||
47 | } | ||
48 | |||
37 | function setBlacklistSort (req: express.Request, res: express.Response, next: express.NextFunction) { | 49 | function setBlacklistSort (req: express.Request, res: express.Response, next: express.NextFunction) { |
38 | let newSort: SortType = { sortModel: undefined, sortValue: undefined } | 50 | let newSort: SortType = { sortModel: undefined, sortValue: undefined } |
39 | 51 | ||
@@ -63,5 +75,7 @@ export { | |||
63 | setVideoAbusesSort, | 75 | setVideoAbusesSort, |
64 | setVideoChannelsSort, | 76 | setVideoChannelsSort, |
65 | setVideosSort, | 77 | setVideosSort, |
66 | setBlacklistSort | 78 | setBlacklistSort, |
79 | setFollowersSort, | ||
80 | setFollowingSort | ||
67 | } | 81 | } |