From: Chocobozzz Date: Tue, 27 Mar 2018 12:10:48 +0000 (+0200) Subject: Improve SQL request for video AP request X-Git-Tag: v1.0.0-beta.2~15 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e53f952ebade7410e77c736d311379ee0a7ff374;p=oweals%2Fpeertube.git Improve SQL request for video AP request --- 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() } ] }