aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/account/user.ts4
-rw-r--r--server/models/video/video.ts10
2 files changed, 12 insertions, 2 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index e850d1e6d..f64568c54 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -710,7 +710,7 @@ export class UserModel extends Model<UserModel> {
710 required: true, 710 required: true,
711 include: [ 711 include: [
712 { 712 {
713 attributes: [ 'id', 'videoId' ], 713 attributes: [],
714 model: VideoLiveModel.unscoped(), 714 model: VideoLiveModel.unscoped(),
715 required: true, 715 required: true,
716 where: { 716 where: {
@@ -726,7 +726,7 @@ export class UserModel extends Model<UserModel> {
726 ] 726 ]
727 } 727 }
728 728
729 return UserModel.findOne(query) 729 return UserModel.unscoped().findOne(query)
730 } 730 }
731 731
732 static generateUserQuotaBaseSQL (options: { 732 static generateUserQuotaBaseSQL (options: {
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 8493ab802..78fec5585 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -128,6 +128,7 @@ import { VideoStreamingPlaylistModel } from './video-streaming-playlist'
128import { VideoTagModel } from './video-tag' 128import { VideoTagModel } from './video-tag'
129import { VideoViewModel } from './video-view' 129import { VideoViewModel } from './video-view'
130import { LiveManager } from '@server/lib/live-manager' 130import { LiveManager } from '@server/lib/live-manager'
131import { VideoLiveModel } from './video-live'
131 132
132export enum ScopeNames { 133export enum ScopeNames {
133 AVAILABLE_FOR_LIST_IDS = 'AVAILABLE_FOR_LIST_IDS', 134 AVAILABLE_FOR_LIST_IDS = 'AVAILABLE_FOR_LIST_IDS',
@@ -725,6 +726,15 @@ export class VideoModel extends Model<VideoModel> {
725 }) 726 })
726 VideoBlacklist: VideoBlacklistModel 727 VideoBlacklist: VideoBlacklistModel
727 728
729 @HasOne(() => VideoLiveModel, {
730 foreignKey: {
731 name: 'videoId',
732 allowNull: false
733 },
734 onDelete: 'cascade'
735 })
736 VideoLive: VideoLiveModel
737
728 @HasOne(() => VideoImportModel, { 738 @HasOne(() => VideoImportModel, {
729 foreignKey: { 739 foreignKey: {
730 name: 'videoId', 740 name: 'videoId',