aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-22 16:39:37 +0200
committerChocobozzz <me@florianbigard.com>2021-10-22 16:40:48 +0200
commit0c691a182c7aeaf0d0e6f7f71d46d6f558e2843b (patch)
tree8e01303d264792e114c20a0d1d530df48841ee6f /server
parent532e6a4172154716d6c6ab2a7f715625d600987c (diff)
downloadPeerTube-0c691a182c7aeaf0d0e6f7f71d46d6f558e2843b.tar.gz
PeerTube-0c691a182c7aeaf0d0e6f7f71d46d6f558e2843b.tar.zst
PeerTube-0c691a182c7aeaf0d0e6f7f71d46d6f558e2843b.zip
Fix sequelize order typings
Diffstat (limited to 'server')
-rw-r--r--server/models/user/user.ts2
-rw-r--r--server/models/utils.ts6
-rw-r--r--server/models/video/tag.ts2
-rw-r--r--server/models/video/video.ts2
4 files changed, 6 insertions, 6 deletions
diff --git a/server/models/user/user.ts b/server/models/user/user.ts
index ddce455a1..b56f37e55 100644
--- a/server/models/user/user.ts
+++ b/server/models/user/user.ts
@@ -487,7 +487,7 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {
487 ')' 487 ')'
488 ), 488 ),
489 'videoQuotaUsed' 489 'videoQuotaUsed'
490 ] as any // FIXME: typings 490 ]
491 ] 491 ]
492 }, 492 },
493 offset: start, 493 offset: start,
diff --git a/server/models/utils.ts b/server/models/utils.ts
index 83b2b8f03..6a109056f 100644
--- a/server/models/utils.ts
+++ b/server/models/utils.ts
@@ -74,8 +74,8 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or
74 finalField = field 74 finalField = field
75 } 75 }
76 76
77 const firstSort = typeof finalField === 'string' 77 const firstSort: OrderItem = typeof finalField === 'string'
78 ? finalField.split('.').concat([ direction ]) as any // FIXME: sequelize typings 78 ? finalField.split('.').concat([ direction ]) as OrderItem
79 : [ finalField, direction ] 79 : [ finalField, direction ]
80 80
81 return [ firstSort, lastSort ] 81 return [ firstSort, lastSort ]
@@ -84,7 +84,7 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or
84function getBlacklistSort (model: any, value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] { 84function getBlacklistSort (model: any, value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {
85 const [ firstSort ] = getSort(value) 85 const [ firstSort ] = getSort(value)
86 86
87 if (model) return [ [ literal(`"${model}.${firstSort[0]}" ${firstSort[1]}`) ], lastSort ] as any[] // FIXME: typings 87 if (model) return [ [ literal(`"${model}.${firstSort[0]}" ${firstSort[1]}`) ], lastSort ] as OrderItem[]
88 return [ firstSort, lastSort ] 88 return [ firstSort, lastSort ]
89} 89}
90 90
diff --git a/server/models/video/tag.ts b/server/models/video/tag.ts
index c1eebe27f..61dfb224d 100644
--- a/server/models/video/tag.ts
+++ b/server/models/video/tag.ts
@@ -18,7 +18,7 @@ import { VideoTagModel } from './video-tag'
18 }, 18 },
19 { 19 {
20 name: 'tag_lower_name', 20 name: 'tag_lower_name',
21 fields: [ fn('lower', col('name')) ] as any // FIXME: typings 21 fields: [ fn('lower', col('name')) ]
22 } 22 }
23 ] 23 ]
24}) 24})
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index a62ae2f23..b5c46c86c 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -864,7 +864,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
864 distinct: true, 864 distinct: true,
865 offset: start, 865 offset: start,
866 limit: count, 866 limit: count,
867 order: getVideoSort('-createdAt', [ 'Tags', 'name', 'ASC' ] as any), // FIXME: sequelize typings 867 order: getVideoSort('-createdAt', [ 'Tags', 'name', 'ASC' ]),
868 where: { 868 where: {
869 id: { 869 id: {
870 [Op.in]: Sequelize.literal('(' + rawQuery + ')') 870 [Op.in]: Sequelize.literal('(' + rawQuery + ')')