]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Improve SQL request for video AP request
authorChocobozzz <me@florianbigard.com>
Tue, 27 Mar 2018 12:10:48 +0000 (14:10 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 27 Mar 2018 12:29:22 +0000 (14:29 +0200)
server/models/video/video.ts

index 0d56f6ae9cf60dd69fa272dc42097743a9a8cd3b..3611eca8900fa1b513c430f3216e44b26ea7ac1c 100644 (file)
@@ -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()
       }
     ]
   }