diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-19 09:43:01 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-19 09:43:01 +0200 |
commit | 8a02bd0433b7101c5ea36e87a4edb63204d2adec (patch) | |
tree | d7ab4b6164aef752c216bd2f22f8b3b270a724b8 /server/middlewares/sort.ts | |
parent | 9fd540562c356cb54b98861d2d9e7d4fbfcd00e0 (diff) | |
download | PeerTube-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.ts | 7 |
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' | |||
4 | import { SortType } from '../helpers' | 4 | import { SortType } from '../helpers' |
5 | import { database } from '../initializers' | 5 | import { database } from '../initializers' |
6 | 6 | ||
7 | function 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 | |||
7 | function setUsersSort (req: express.Request, res: express.Response, next: express.NextFunction) { | 13 | function 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 | ||
48 | export { | 54 | export { |
55 | setPodsSort, | ||
49 | setUsersSort, | 56 | setUsersSort, |
50 | setVideoAbusesSort, | 57 | setVideoAbusesSort, |
51 | setVideosSort, | 58 | setVideosSort, |