aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/sort.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-19 09:43:01 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-19 09:43:01 +0200
commit8a02bd0433b7101c5ea36e87a4edb63204d2adec (patch)
treed7ab4b6164aef752c216bd2f22f8b3b270a724b8 /server/middlewares/sort.ts
parent9fd540562c356cb54b98861d2d9e7d4fbfcd00e0 (diff)
downloadPeerTube-8a02bd0433b7101c5ea36e87a4edb63204d2adec.tar.gz
PeerTube-8a02bd0433b7101c5ea36e87a4edb63204d2adec.tar.zst
PeerTube-8a02bd0433b7101c5ea36e87a4edb63204d2adec.zip
Add pod list endpoint with pagination, sort...
Diffstat (limited to 'server/middlewares/sort.ts')
-rw-r--r--server/middlewares/sort.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/server/middlewares/sort.ts b/server/middlewares/sort.ts
index 687ce097b..2c70ff5f0 100644
--- a/server/middlewares/sort.ts
+++ b/server/middlewares/sort.ts
@@ -4,6 +4,12 @@ import * as express from 'express'
4import { SortType } from '../helpers' 4import { SortType } from '../helpers'
5import { database } from '../initializers' 5import { database } from '../initializers'
6 6
7function setPodsSort (req: express.Request, res: express.Response, next: express.NextFunction) {
8 if (!req.query.sort) req.query.sort = '-createdAt'
9
10 return next()
11}
12
7function setUsersSort (req: express.Request, res: express.Response, next: express.NextFunction) { 13function setUsersSort (req: express.Request, res: express.Response, next: express.NextFunction) {
8 if (!req.query.sort) req.query.sort = '-createdAt' 14 if (!req.query.sort) req.query.sort = '-createdAt'
9 15
@@ -46,6 +52,7 @@ function setBlacklistSort (req: express.Request, res: express.Response, next: ex
46// --------------------------------------------------------------------------- 52// ---------------------------------------------------------------------------
47 53
48export { 54export {
55 setPodsSort,
49 setUsersSort, 56 setUsersSort,
50 setVideoAbusesSort, 57 setVideoAbusesSort,
51 setVideosSort, 58 setVideosSort,