]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/utils.ts
Don't cache torrent files
[github/Chocobozzz/PeerTube.git] / server / models / utils.ts
index 7ba96815e282a512db020243c68816ea6899ca8a..1bf61d2a693021aff86a88732587dfabe3ccd87b 100644 (file)
@@ -19,9 +19,17 @@ function addMethodsToModel (model: any, classMethods: Function[], instanceMethod
   instanceMethods.forEach(m => model.prototype[m.name] = m)
 }
 
+function getSortOnModel (model: any, value: string) {
+  let sort = getSort(value)
+
+  if (model) return [ { model: model }, sort[0], sort[1] ]
+  return sort
+}
+
 // ---------------------------------------------------------------------------
 
 export {
   addMethodsToModel,
-  getSort
+  getSort,
+  getSortOnModel
 }