mirror of https://github.com/Chocobozzz/PeerTube
Fix sequelize order typings
parent
532e6a4172
commit
0c691a182c
|
@ -487,7 +487,7 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> {
|
||||||
')'
|
')'
|
||||||
),
|
),
|
||||||
'videoQuotaUsed'
|
'videoQuotaUsed'
|
||||||
] as any // FIXME: typings
|
]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
offset: start,
|
offset: start,
|
||||||
|
|
|
@ -74,8 +74,8 @@ function getVideoSort (value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): Or
|
||||||
finalField = field
|
finalField = field
|
||||||
}
|
}
|
||||||
|
|
||||||
const firstSort = typeof finalField === 'string'
|
const firstSort: OrderItem = typeof finalField === 'string'
|
||||||
? finalField.split('.').concat([ direction ]) as any // FIXME: sequelize typings
|
? finalField.split('.').concat([ direction ]) as OrderItem
|
||||||
: [ finalField, direction ]
|
: [ finalField, direction ]
|
||||||
|
|
||||||
return [ firstSort, lastSort ]
|
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[] {
|
function getBlacklistSort (model: any, value: string, lastSort: OrderItem = [ 'id', 'ASC' ]): OrderItem[] {
|
||||||
const [ firstSort ] = getSort(value)
|
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 ]
|
return [ firstSort, lastSort ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { VideoTagModel } from './video-tag'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'tag_lower_name',
|
name: 'tag_lower_name',
|
||||||
fields: [ fn('lower', col('name')) ] as any // FIXME: typings
|
fields: [ fn('lower', col('name')) ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
|
@ -864,7 +864,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
|
||||||
distinct: true,
|
distinct: true,
|
||||||
offset: start,
|
offset: start,
|
||||||
limit: count,
|
limit: count,
|
||||||
order: getVideoSort('-createdAt', [ 'Tags', 'name', 'ASC' ] as any), // FIXME: sequelize typings
|
order: getVideoSort('-createdAt', [ 'Tags', 'name', 'ASC' ]),
|
||||||
where: {
|
where: {
|
||||||
id: {
|
id: {
|
||||||
[Op.in]: Sequelize.literal('(' + rawQuery + ')')
|
[Op.in]: Sequelize.literal('(' + rawQuery + ')')
|
||||||
|
|
Loading…
Reference in New Issue