Browse Source

Fix video sort

Chocobozzz 5 years ago
parent
commit
afa4374ab4
1 changed files with 5 additions and 1 deletions
  1. 5 1
      server/models/utils.ts

+ 5 - 1
server/models/utils.ts

@@ -29,7 +29,11 @@ function getVideoSort (value: string, lastSort: string[] = [ 'id', 'ASC' ]) {
     ]
   }
 
-  return [ field.split('.').concat([ direction ]), lastSort ]
+  const firstSort = typeof field === 'string' ?
+    field.split('.').concat([ direction ]) :
+    [ field, direction ]
+
+  return [ firstSort, lastSort ]
 }
 
 function getSortOnModel (model: any, value: string, lastSort: string[] = [ 'id', 'ASC' ]) {