Video get SQL optimization
authorChocobozzz <me@florianbigard.com>
Thu, 18 Jan 2018 16:44:04 +0000 (17:44 +0100)
committerChocobozzz <me@florianbigard.com>
Thu, 18 Jan 2018 16:44:04 +0000 (17:44 +0100)
server/models/video/video.ts

index 7af68b20bbdfa66f4e3e3bc040115ecdb32af61a..71e37e1471a1f42dec6927bfbf02cdb72de69623 100644 (file)
@@ -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
                   }
                 ]