]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/utils.ts
Typo
[github/Chocobozzz/PeerTube.git] / server / models / utils.ts
index 6a109056ff964c621d2694edb961c8380e1a126b..70bfbdb8bfa4748dc770186c7a95b913454df570 100644 (file)
@@ -1,5 +1,4 @@
 import { literal, Op, OrderItem, Sequelize } from 'sequelize'
-import { Col } from 'sequelize/types/lib/utils'
 import validator from 'validator'
 
 type SortType = { sortModel: string, sortValue: string }
@@ -8,7 +7,7 @@ type SortType = { sortModel: string, sortValue: string }
 function getSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {
   const { direction, field } = buildDirectionAndField(value)
 
-  let finalField: string | Col
+  let finalField: string | ReturnType<typeof Sequelize.col>
 
   if (field.toLowerCase() === 'match') { // Search
     finalField = Sequelize.col('similarity')
@@ -65,7 +64,7 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or
     ]
   }
 
-  let finalField: string | Col
+  let finalField: string | ReturnType<typeof Sequelize.col>
 
   // Alias
   if (field.toLowerCase() === 'match') { // Search
@@ -182,7 +181,7 @@ function buildServerIdsFollowedBy (actorId: any) {
     'SELECT "actor"."serverId" FROM "actorFollow" ' +
     'INNER JOIN "actor" ON actor.id = "actorFollow"."targetActorId" ' +
     'WHERE "actorFollow"."actorId" = ' + actorIdNumber +
-    ')'
+  ')'
 }
 
 function buildWhereIdOrUUID (id: number | string) {
@@ -238,7 +237,8 @@ function searchAttribute (sourceField?: string, targetField?: string) {
 
   return {
     [targetField]: {
-      [Op.iLike]: `%${sourceField}%`
+      // FIXME: ts error
+      [Op.iLike as any]: `%${sourceField}%`
     }
   }
 }