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.ts29
1 files changed, 3 insertions, 26 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 4979cee50..9d56eb13c 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -118,6 +118,7 @@ import {
118 videoModelToFormattedJSON 118 videoModelToFormattedJSON
119} from './formatter/video-format-utils' 119} from './formatter/video-format-utils'
120import { ScheduleVideoUpdateModel } from './schedule-video-update' 120import { ScheduleVideoUpdateModel } from './schedule-video-update'
121import { VideosModelGetQueryBuilder } from './sql/video-model-get-query-builder'
121import { BuildVideosListQueryOptions, VideosIdListQueryBuilder } from './sql/videos-id-list-query-builder' 122import { BuildVideosListQueryOptions, VideosIdListQueryBuilder } from './sql/videos-id-list-query-builder'
122import { VideosModelListQueryBuilder } from './sql/videos-model-list-query-builder' 123import { VideosModelListQueryBuilder } from './sql/videos-model-list-query-builder'
123import { TagModel } from './tag' 124import { TagModel } from './tag'
@@ -1475,33 +1476,9 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1475 userId?: number 1476 userId?: number
1476 }): Promise<MVideoDetails> { 1477 }): Promise<MVideoDetails> {
1477 const { id, t, userId } = parameters 1478 const { id, t, userId } = parameters
1478 const where = buildWhereIdOrUUID(id) 1479 const queryBuilder = new VideosModelGetQueryBuilder(VideoModel.sequelize)
1479
1480 const options = {
1481 order: [ [ 'Tags', 'name', 'ASC' ] ] as any, // FIXME: sequelize typings
1482 where,
1483 transaction: t
1484 }
1485 1480
1486 const scopes: (string | ScopeOptions)[] = [ 1481 return queryBuilder.queryVideos({ id, transaction: t, forGetAPI: true, userId })
1487 ScopeNames.WITH_TAGS,
1488 ScopeNames.WITH_BLACKLISTED,
1489 ScopeNames.WITH_ACCOUNT_DETAILS,
1490 ScopeNames.WITH_SCHEDULED_UPDATE,
1491 ScopeNames.WITH_THUMBNAILS,
1492 ScopeNames.WITH_LIVE,
1493 ScopeNames.WITH_TRACKERS,
1494 { method: [ ScopeNames.WITH_WEBTORRENT_FILES, true ] },
1495 { method: [ ScopeNames.WITH_STREAMING_PLAYLISTS, true ] }
1496 ]
1497
1498 if (userId) {
1499 scopes.push({ method: [ ScopeNames.WITH_USER_HISTORY, userId ] })
1500 }
1501
1502 return VideoModel
1503 .scope(scopes)
1504 .findOne(options)
1505 } 1482 }
1506 1483
1507 static async getStats () { 1484 static async getStats () {