aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index f8a099d9c..749ef7197 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -31,6 +31,7 @@ import { LiveManager } from '@server/lib/live-manager'
31import { getHLSDirectory, getVideoFilePath } from '@server/lib/video-paths' 31import { getHLSDirectory, getVideoFilePath } from '@server/lib/video-paths'
32import { getServerActor } from '@server/models/application/application' 32import { getServerActor } from '@server/models/application/application'
33import { ModelCache } from '@server/models/model-cache' 33import { ModelCache } from '@server/models/model-cache'
34import { AttributesOnly } from '@shared/core-utils'
34import { VideoFile } from '@shared/models/videos/video-file.model' 35import { VideoFile } from '@shared/models/videos/video-file.model'
35import { ResultList, UserRight, VideoPrivacy, VideoState } from '../../../shared' 36import { ResultList, UserRight, VideoPrivacy, VideoState } from '../../../shared'
36import { VideoObject } from '../../../shared/models/activitypub/objects' 37import { VideoObject } from '../../../shared/models/activitypub/objects'
@@ -489,7 +490,7 @@ export type AvailableForListIDsOptions = {
489 } 490 }
490 ] 491 ]
491}) 492})
492export class VideoModel extends Model { 493export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
493 494
494 @AllowNull(false) 495 @AllowNull(false)
495 @Default(DataType.UUIDV4) 496 @Default(DataType.UUIDV4)
@@ -1617,7 +1618,7 @@ export class VideoModel extends Model {
1617 includeLocalVideos: true 1618 includeLocalVideos: true
1618 } 1619 }
1619 1620
1620 const { query, replacements } = buildListQuery(VideoModel, queryOptions) 1621 const { query, replacements } = buildListQuery(VideoModel.sequelize, queryOptions)
1621 1622
1622 return this.sequelize.query<any>(query, { replacements, type: QueryTypes.SELECT }) 1623 return this.sequelize.query<any>(query, { replacements, type: QueryTypes.SELECT })
1623 .then(rows => rows.map(r => r[field])) 1624 .then(rows => rows.map(r => r[field]))
@@ -1645,7 +1646,7 @@ export class VideoModel extends Model {
1645 if (countVideos !== true) return Promise.resolve(undefined) 1646 if (countVideos !== true) return Promise.resolve(undefined)
1646 1647
1647 const countOptions = Object.assign({}, options, { isCount: true }) 1648 const countOptions = Object.assign({}, options, { isCount: true })
1648 const { query: queryCount, replacements: replacementsCount } = buildListQuery(VideoModel, countOptions) 1649 const { query: queryCount, replacements: replacementsCount } = buildListQuery(VideoModel.sequelize, countOptions)
1649 1650
1650 return VideoModel.sequelize.query<any>(queryCount, { replacements: replacementsCount, type: QueryTypes.SELECT }) 1651 return VideoModel.sequelize.query<any>(queryCount, { replacements: replacementsCount, type: QueryTypes.SELECT })
1651 .then(rows => rows.length !== 0 ? rows[0].total : 0) 1652 .then(rows => rows.length !== 0 ? rows[0].total : 0)
@@ -1654,7 +1655,7 @@ export class VideoModel extends Model {
1654 function getModels () { 1655 function getModels () {
1655 if (options.count === 0) return Promise.resolve([]) 1656 if (options.count === 0) return Promise.resolve([])
1656 1657
1657 const { query, replacements, order } = buildListQuery(VideoModel, options) 1658 const { query, replacements, order } = buildListQuery(VideoModel.sequelize, options)
1658 const queryModels = wrapForAPIResults(query, replacements, options, order) 1659 const queryModels = wrapForAPIResults(query, replacements, options, order)
1659 1660
1660 return VideoModel.sequelize.query<any>(queryModels, { replacements, type: QueryTypes.SELECT, nest: true }) 1661 return VideoModel.sequelize.query<any>(queryModels, { replacements, type: QueryTypes.SELECT, nest: true })