From 8a02bd0433b7101c5ea36e87a4edb63204d2adec Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Oct 2017 09:43:01 +0200 Subject: Add pod list endpoint with pagination, sort... --- server/middlewares/sort.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'server/middlewares/sort.ts') 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' import { SortType } from '../helpers' import { database } from '../initializers' +function setPodsSort (req: express.Request, res: express.Response, next: express.NextFunction) { + if (!req.query.sort) req.query.sort = '-createdAt' + + return next() +} + function setUsersSort (req: express.Request, res: express.Response, next: express.NextFunction) { if (!req.query.sort) req.query.sort = '-createdAt' @@ -46,6 +52,7 @@ function setBlacklistSort (req: express.Request, res: express.Response, next: ex // --------------------------------------------------------------------------- export { + setPodsSort, setUsersSort, setVideoAbusesSort, setVideosSort, -- cgit v1.2.3