aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-channel.ts11
-rw-r--r--server/models/video/video.ts14
2 files changed, 12 insertions, 13 deletions
diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts
index 79b9e7d2b..b6a60827f 100644
--- a/server/models/video/video-channel.ts
+++ b/server/models/video/video-channel.ts
@@ -37,7 +37,6 @@ import * as Bluebird from 'bluebird'
37import { 37import {
38 MChannelAccountDefault, 38 MChannelAccountDefault,
39 MChannelActor, 39 MChannelActor,
40 MChannelActorAccountDefault,
41 MChannelActorAccountDefaultVideos 40 MChannelActorAccountDefaultVideos
42} from '../../typings/models/video' 41} from '../../typings/models/video'
43 42
@@ -376,13 +375,13 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
376 }) 375 })
377 } 376 }
378 377
379 static loadByIdAndPopulateAccount (id: number): Bluebird<MChannelActorAccountDefault> { 378 static loadByIdAndPopulateAccount (id: number): Bluebird<MChannelAccountDefault> {
380 return VideoChannelModel.unscoped() 379 return VideoChannelModel.unscoped()
381 .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) 380 .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ])
382 .findByPk(id) 381 .findByPk(id)
383 } 382 }
384 383
385 static loadByIdAndAccount (id: number, accountId: number): Bluebird<MChannelActorAccountDefault> { 384 static loadByIdAndAccount (id: number, accountId: number): Bluebird<MChannelAccountDefault> {
386 const query = { 385 const query = {
387 where: { 386 where: {
388 id, 387 id,
@@ -395,7 +394,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
395 .findOne(query) 394 .findOne(query)
396 } 395 }
397 396
398 static loadAndPopulateAccount (id: number): Bluebird<MChannelActorAccountDefault> { 397 static loadAndPopulateAccount (id: number): Bluebird<MChannelAccountDefault> {
399 return VideoChannelModel.unscoped() 398 return VideoChannelModel.unscoped()
400 .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ]) 399 .scope([ ScopeNames.WITH_ACTOR, ScopeNames.WITH_ACCOUNT ])
401 .findByPk(id) 400 .findByPk(id)
@@ -427,7 +426,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
427 return VideoChannelModel.loadByNameAndHostAndPopulateAccount(name, host) 426 return VideoChannelModel.loadByNameAndHostAndPopulateAccount(name, host)
428 } 427 }
429 428
430 static loadLocalByNameAndPopulateAccount (name: string): Bluebird<MChannelActorAccountDefault> { 429 static loadLocalByNameAndPopulateAccount (name: string): Bluebird<MChannelAccountDefault> {
431 const query = { 430 const query = {
432 include: [ 431 include: [
433 { 432 {
@@ -446,7 +445,7 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
446 .findOne(query) 445 .findOne(query)
447 } 446 }
448 447
449 static loadByNameAndHostAndPopulateAccount (name: string, host: string): Bluebird<MChannelActorAccountDefault> { 448 static loadByNameAndHostAndPopulateAccount (name: string, host: string): Bluebird<MChannelAccountDefault> {
450 const query = { 449 const query = {
451 include: [ 450 include: [
452 { 451 {
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 7b1f0bc31..e62bde344 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -121,18 +121,18 @@ import { createTorrentPromise } from '../../helpers/webtorrent'
121import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type' 121import { VideoStreamingPlaylistType } from '../../../shared/models/videos/video-streaming-playlist.type'
122import { 122import {
123 MChannel, 123 MChannel,
124 MChannelActorAccountDefault, 124 MChannelAccountDefault,
125 MChannelId, 125 MChannelId,
126 MUserAccountId, 126 MUserAccountId,
127 MUserId, 127 MUserId,
128 MVideoAccountAllFiles,
129 MVideoAccountLight, 128 MVideoAccountLight,
129 MVideoAccountLightBlacklistAllFiles,
130 MVideoDetails, 130 MVideoDetails,
131 MVideoForUser,
131 MVideoFullLight, 132 MVideoFullLight,
132 MVideoIdThumbnail, 133 MVideoIdThumbnail,
133 MVideoThumbnail, 134 MVideoThumbnail,
134 MVideoWithAllFiles, 135 MVideoWithAllFiles,
135 MVideoWithBlacklistThumbnailScheduled,
136 MVideoWithRights 136 MVideoWithRights
137} from '../../typings/models' 137} from '../../typings/models'
138import { MVideoFile, MVideoFileRedundanciesOpt } from '../../typings/models/video/video-file' 138import { MVideoFile, MVideoFileRedundanciesOpt } from '../../typings/models/video/video-file'
@@ -1015,7 +1015,7 @@ export class VideoModel extends Model<VideoModel> {
1015 AccountModel 1015 AccountModel
1016 ], 1016 ],
1017 transaction: options.transaction 1017 transaction: options.transaction
1018 }) as MChannelActorAccountDefault 1018 }) as MChannelAccountDefault
1019 } 1019 }
1020 1020
1021 return sendDeleteVideo(instance, options.transaction) 1021 return sendDeleteVideo(instance, options.transaction)
@@ -1209,10 +1209,10 @@ export class VideoModel extends Model<VideoModel> {
1209 1209
1210 return Promise.all([ 1210 return Promise.all([
1211 VideoModel.count(countQuery), 1211 VideoModel.count(countQuery),
1212 VideoModel.scope(findScopes).findAll(findQuery) 1212 VideoModel.scope(findScopes).findAll<MVideoForUser>(findQuery)
1213 ]).then(([ count, rows ]) => { 1213 ]).then(([ count, rows ]) => {
1214 return { 1214 return {
1215 data: rows as MVideoWithBlacklistThumbnailScheduled[], 1215 data: rows,
1216 total: count 1216 total: count
1217 } 1217 }
1218 }) 1218 })
@@ -1468,7 +1468,7 @@ export class VideoModel extends Model<VideoModel> {
1468 return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(query) 1468 return VideoModel.scope(ScopeNames.WITH_THUMBNAILS).findOne(query)
1469 } 1469 }
1470 1470
1471 static loadByUrlAndPopulateAccount (url: string, transaction?: Transaction): Bluebird<MVideoAccountAllFiles> { 1471 static loadByUrlAndPopulateAccount (url: string, transaction?: Transaction): Bluebird<MVideoAccountLightBlacklistAllFiles> {
1472 const query: FindOptions = { 1472 const query: FindOptions = {
1473 where: { 1473 where: {
1474 url 1474 url