1 import express from 'express'
3 const setDefaultSort = setDefaultSortFactory('-createdAt')
4 const setDefaultVideosSort = setDefaultSortFactory('-publishedAt')
6 const setDefaultVideoRedundanciesSort = setDefaultSortFactory('name')
8 const setDefaultSearchSort = setDefaultSortFactory('-match')
9 const setBlacklistSort = setDefaultSortFactory('-createdAt')
11 // ---------------------------------------------------------------------------
17 setDefaultVideoRedundanciesSort,
21 // ---------------------------------------------------------------------------
23 function setDefaultSortFactory (sort: string) {
24 return (req: express.Request, res: express.Response, next: express.NextFunction) => {
25 if (!req.query.sort) req.query.sort = sort