From: Chocobozzz Date: Thu, 18 Jan 2018 16:44:04 +0000 (+0100) Subject: Video get SQL optimization X-Git-Tag: v0.0.12-alpha~3 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3e5002477a7643b79aae98ce5e507a7aced6cb8f;p=oweals%2Fpeertube.git Video get SQL optimization --- diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 7af68b20b..71e37e147 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -127,22 +127,30 @@ enum ScopeNames { attributes: { exclude: [ 'privateKey', 'publicKey' ] }, - model: () => ActorModel, - required: true + model: () => ActorModel.unscoped(), + required: true, + include: [ + { + attributes: [ 'host' ], + model: () => ServerModel.unscoped(), + required: false + } + ] }, { - model: () => AccountModel, + model: () => AccountModel.unscoped(), required: true, include: [ { - model: () => ActorModel, + model: () => ActorModel.unscoped(), attributes: { exclude: [ 'privateKey', 'publicKey' ] }, required: true, include: [ { - model: () => ServerModel, + attributes: [ 'host' ], + model: () => ServerModel.unscoped(), required: false } ]