From 3e5002477a7643b79aae98ce5e507a7aced6cb8f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 18 Jan 2018 17:44:04 +0100 Subject: [PATCH] Video get SQL optimization --- server/models/video/video.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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 } ] -- 2.41.0