aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-01-17 10:50:33 +0100
committerChocobozzz <me@florianbigard.com>2018-01-18 15:42:20 +0100
commit1174a8479ab9ee47b3305d668fe757435057a298 (patch)
tree6d5e4702536c0d4b77c06ecab9e3db65c00d59d8 /server/middlewares
parent6139124c673af2af02032905544909a2583dda2b (diff)
downloadPeerTube-1174a8479ab9ee47b3305d668fe757435057a298.tar.gz
PeerTube-1174a8479ab9ee47b3305d668fe757435057a298.tar.zst
PeerTube-1174a8479ab9ee47b3305d668fe757435057a298.zip
Set sort refractoring
Diffstat (limited to 'server/middlewares')
-rw-r--r--server/middlewares/sort.ts62
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'
2import 'express-validator' 2import 'express-validator'
3import { SortType } from '../helpers/utils' 3import { SortType } from '../helpers/utils'
4 4
5function setAccountsSort (req: express.Request, res: express.Response, next: express.NextFunction) { 5function 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
11function 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
17function 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
23function 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
29function 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
35function 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
41function 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
47function 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
53function 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
82export { 34export {
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}