aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/sort.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/sort.js')
-rw-r--r--server/middlewares/sort.js11
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
3const sortMiddleware = { 3const sortMiddleware = {
4 setUsersSort, 4 setUsersSort,
5 setVideoAbusesSort,
5 setVideosSort 6 setVideosSort
6} 7}
7 8
8function setUsersSort (req, res, next) { 9function 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
15function 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
14function setVideosSort (req, res, next) { 21function 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}