diff options
Diffstat (limited to 'server/middlewares')
-rw-r--r-- | server/middlewares/sort.ts | 62 |
1 files changed, 3 insertions, 59 deletions
diff --git a/server/middlewares/sort.ts b/server/middlewares/sort.ts index 4f524b49a..cdb809e75 100644 --- a/server/middlewares/sort.ts +++ b/server/middlewares/sort.ts | |||
@@ -2,55 +2,7 @@ import * as express from 'express' | |||
2 | import 'express-validator' | 2 | import 'express-validator' |
3 | import { SortType } from '../helpers/utils' | 3 | import { SortType } from '../helpers/utils' |
4 | 4 | ||
5 | function setAccountsSort (req: express.Request, res: express.Response, next: express.NextFunction) { | 5 | function setDefaultSort (req: express.Request, res: express.Response, next: express.NextFunction) { |
6 | if (!req.query.sort) req.query.sort = '-createdAt' | ||
7 | |||
8 | return next() | ||
9 | } | ||
10 | |||
11 | function setUsersSort (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
12 | if (!req.query.sort) req.query.sort = '-createdAt' | ||
13 | |||
14 | return next() | ||
15 | } | ||
16 | |||
17 | function setJobsSort (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
18 | if (!req.query.sort) req.query.sort = '-createdAt' | ||
19 | |||
20 | return next() | ||
21 | } | ||
22 | |||
23 | function setVideoAbusesSort (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
24 | if (!req.query.sort) req.query.sort = '-createdAt' | ||
25 | |||
26 | return next() | ||
27 | } | ||
28 | |||
29 | function setVideoChannelsSort (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
30 | if (!req.query.sort) req.query.sort = '-createdAt' | ||
31 | |||
32 | return next() | ||
33 | } | ||
34 | |||
35 | function setVideosSort (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
36 | if (!req.query.sort) req.query.sort = '-createdAt' | ||
37 | |||
38 | return next() | ||
39 | } | ||
40 | |||
41 | function setVideoCommentThreadsSort (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
42 | if (!req.query.sort) req.query.sort = '-createdAt' | ||
43 | |||
44 | return next() | ||
45 | } | ||
46 | |||
47 | function setFollowersSort (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
48 | if (!req.query.sort) req.query.sort = '-createdAt' | ||
49 | |||
50 | return next() | ||
51 | } | ||
52 | |||
53 | function setFollowingSort (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
54 | if (!req.query.sort) req.query.sort = '-createdAt' | 6 | if (!req.query.sort) req.query.sort = '-createdAt' |
55 | 7 | ||
56 | return next() | 8 | return next() |
@@ -80,14 +32,6 @@ function setBlacklistSort (req: express.Request, res: express.Response, next: ex | |||
80 | // --------------------------------------------------------------------------- | 32 | // --------------------------------------------------------------------------- |
81 | 33 | ||
82 | export { | 34 | export { |
83 | setUsersSort, | 35 | setDefaultSort, |
84 | setVideoAbusesSort, | 36 | setBlacklistSort |
85 | setVideoChannelsSort, | ||
86 | setVideosSort, | ||
87 | setBlacklistSort, | ||
88 | setFollowersSort, | ||
89 | setFollowingSort, | ||
90 | setJobsSort, | ||
91 | setVideoCommentThreadsSort, | ||
92 | setAccountsSort | ||
93 | } | 37 | } |