diff options
Diffstat (limited to 'server/middlewares/sort.js')
-rw-r--r-- | server/middlewares/sort.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/server/middlewares/sort.js b/server/middlewares/sort.js index f0b7274eb..39e167265 100644 --- a/server/middlewares/sort.js +++ b/server/middlewares/sort.js | |||
@@ -2,17 +2,24 @@ | |||
2 | 2 | ||
3 | const sortMiddleware = { | 3 | const sortMiddleware = { |
4 | setUsersSort, | 4 | setUsersSort, |
5 | setVideoAbusesSort, | ||
5 | setVideosSort | 6 | setVideosSort |
6 | } | 7 | } |
7 | 8 | ||
8 | function setUsersSort (req, res, next) { | 9 | function setUsersSort (req, res, next) { |
9 | if (!req.query.sort) req.query.sort = '-createdDate' | 10 | if (!req.query.sort) req.query.sort = '-createdAt' |
11 | |||
12 | return next() | ||
13 | } | ||
14 | |||
15 | function setVideoAbusesSort (req, res, next) { | ||
16 | if (!req.query.sort) req.query.sort = '-createdAt' | ||
10 | 17 | ||
11 | return next() | 18 | return next() |
12 | } | 19 | } |
13 | 20 | ||
14 | function setVideosSort (req, res, next) { | 21 | function setVideosSort (req, res, next) { |
15 | if (!req.query.sort) req.query.sort = '-createdDate' | 22 | if (!req.query.sort) req.query.sort = '-createdAt' |
16 | 23 | ||
17 | return next() | 24 | return next() |
18 | } | 25 | } |