From e53f952ebade7410e77c736d311379ee0a7ff374 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 27 Mar 2018 14:10:48 +0200 Subject: Improve SQL request for video AP request --- server/models/video/video.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'server') diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 0d56f6ae9..3611eca89 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -203,7 +203,7 @@ enum ScopeNames { [ScopeNames.WITH_FILES]: { include: [ { - model: () => VideoFileModel, + model: () => VideoFileModel.unscoped(), required: true } ] @@ -211,8 +211,7 @@ enum ScopeNames { [ScopeNames.WITH_SHARES]: { include: [ { - model: () => VideoShareModel, - include: [ () => ActorModel ] + model: () => VideoShareModel.unscoped() } ] }, @@ -220,14 +219,25 @@ enum ScopeNames { include: [ { model: () => AccountVideoRateModel, - include: [ () => AccountModel ] + include: [ + { + model: () => AccountModel.unscoped(), + required: true, + include: [ + { + attributes: [ 'url' ], + model: () => ActorModel.unscoped() + } + ] + } + ] } ] }, [ScopeNames.WITH_COMMENTS]: { include: [ { - model: () => VideoCommentModel + model: () => VideoCommentModel.unscoped() } ] } -- cgit v1.2.3