aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-03-27 14:10:48 +0200
committerChocobozzz <me@florianbigard.com>2018-03-27 14:29:22 +0200
commite53f952ebade7410e77c736d311379ee0a7ff374 (patch)
tree43b0f0db24def4712fb418242d8983cfbb74e58c /server
parent1869c87535d31a73a26c5d07718cdf94300cc332 (diff)
downloadPeerTube-e53f952ebade7410e77c736d311379ee0a7ff374.tar.gz
PeerTube-e53f952ebade7410e77c736d311379ee0a7ff374.tar.zst
PeerTube-e53f952ebade7410e77c736d311379ee0a7ff374.zip
Improve SQL request for video AP request
Diffstat (limited to 'server')
-rw-r--r--server/models/video/video.ts20
1 files changed, 15 insertions, 5 deletions
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 {
203 [ScopeNames.WITH_FILES]: { 203 [ScopeNames.WITH_FILES]: {
204 include: [ 204 include: [
205 { 205 {
206 model: () => VideoFileModel, 206 model: () => VideoFileModel.unscoped(),
207 required: true 207 required: true
208 } 208 }
209 ] 209 ]
@@ -211,8 +211,7 @@ enum ScopeNames {
211 [ScopeNames.WITH_SHARES]: { 211 [ScopeNames.WITH_SHARES]: {
212 include: [ 212 include: [
213 { 213 {
214 model: () => VideoShareModel, 214 model: () => VideoShareModel.unscoped()
215 include: [ () => ActorModel ]
216 } 215 }
217 ] 216 ]
218 }, 217 },
@@ -220,14 +219,25 @@ enum ScopeNames {
220 include: [ 219 include: [
221 { 220 {
222 model: () => AccountVideoRateModel, 221 model: () => AccountVideoRateModel,
223 include: [ () => AccountModel ] 222 include: [
223 {
224 model: () => AccountModel.unscoped(),
225 required: true,
226 include: [
227 {
228 attributes: [ 'url' ],
229 model: () => ActorModel.unscoped()
230 }
231 ]
232 }
233 ]
224 } 234 }
225 ] 235 ]
226 }, 236 },
227 [ScopeNames.WITH_COMMENTS]: { 237 [ScopeNames.WITH_COMMENTS]: {
228 include: [ 238 include: [
229 { 239 {
230 model: () => VideoCommentModel 240 model: () => VideoCommentModel.unscoped()
231 } 241 }
232 ] 242 ]
233 } 243 }