]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/sort.ts
Merge branch 'release/1.4.0' into develop
[github/Chocobozzz/PeerTube.git] / server / middlewares / sort.ts
index 6307ee1547e6359eb0c9a410525535cd941ed588..8c27e82379bfbb2b09f04b1bd249ea859ab9f2f3 100644 (file)
@@ -1,6 +1,5 @@
 import * as express from 'express'
-import 'express-validator'
-import { SortType } from '../helpers/utils'
+import { SortType } from '../models/utils'
 
 function setDefaultSort (req: express.Request, res: express.Response, next: express.NextFunction) {
   if (!req.query.sort) req.query.sort = '-createdAt'
@@ -9,13 +8,13 @@ function setDefaultSort (req: express.Request, res: express.Response, next: expr
 }
 
 function setDefaultSearchSort (req: express.Request, res: express.Response, next: express.NextFunction) {
-  if (!req.query.sort) req.query.sort = '-bestmatch'
+  if (!req.query.sort) req.query.sort = '-match'
 
   return next()
 }
 
 function setBlacklistSort (req: express.Request, res: express.Response, next: express.NextFunction) {
-  let newSort: SortType = { sortModel: undefined, sortValue: undefined }
+  let newSort: SortType = { sortModel: undefined, sortValue: '' }
 
   if (!req.query.sort) req.query.sort = '-createdAt'