From 0c691a182c7aeaf0d0e6f7f71d46d6f558e2843b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 22 Oct 2021 16:39:37 +0200 Subject: [PATCH] Fix sequelize order typings --- server/models/user/user.ts | 2 +- server/models/utils.ts | 6 +++--- server/models/video/tag.ts | 2 +- server/models/video/video.ts | 2 +- 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>> { ')' ), 'videoQuotaUsed' - ] as any // FIXME: typings + ] ] }, 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 finalField = field } - const firstSort = typeof finalField === 'string' - ? finalField.split('.').concat([ direction ]) as any // FIXME: sequelize typings + const firstSort: OrderItem = typeof finalField === 'string' + ? finalField.split('.').concat([ direction ]) as OrderItem : [ finalField, direction ] return [ firstSort, lastSort ] @@ -84,7 +84,7 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or function getBlacklistSort (model: any, value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] { const [ firstSort ] = getSort(value) - if (model) return [ [ literal(`"${model}.${firstSort[0]}" ${firstSort[1]}`) ], lastSort ] as any[] // FIXME: typings + if (model) return [ [ literal(`"${model}.${firstSort[0]}" ${firstSort[1]}`) ], lastSort ] as OrderItem[] return [ firstSort, lastSort ] } 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' }, { name: 'tag_lower_name', - fields: [ fn('lower', col('name')) ] as any // FIXME: typings + fields: [ fn('lower', col('name')) ] } ] }) 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>> { distinct: true, offset: start, limit: count, - order: getVideoSort('-createdAt', [ 'Tags', 'name', 'ASC' ] as any), // FIXME: sequelize typings + order: getVideoSort('-createdAt', [ 'Tags', 'name', 'ASC' ]), where: { id: { [Op.in]: Sequelize.literal('(' + rawQuery + ')') -- 2.41.0