Improve SQL request for video AP request

This commit is contained in:
Chocobozzz 2018-03-27 14:10:48 +02:00
parent 1869c87535
commit e53f952eba
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 15 additions and 5 deletions

View File

@ -203,7 +203,7 @@ enum ScopeNames {
[ScopeNames.WITH_FILES]: { [ScopeNames.WITH_FILES]: {
include: [ include: [
{ {
model: () => VideoFileModel, model: () => VideoFileModel.unscoped(),
required: true required: true
} }
] ]
@ -211,8 +211,7 @@ enum ScopeNames {
[ScopeNames.WITH_SHARES]: { [ScopeNames.WITH_SHARES]: {
include: [ include: [
{ {
model: () => VideoShareModel, model: () => VideoShareModel.unscoped()
include: [ () => ActorModel ]
} }
] ]
}, },
@ -220,14 +219,25 @@ enum ScopeNames {
include: [ include: [
{ {
model: () => AccountVideoRateModel, model: () => AccountVideoRateModel,
include: [ () => AccountModel ] include: [
{
model: () => AccountModel.unscoped(),
required: true,
include: [
{
attributes: [ 'url' ],
model: () => ActorModel.unscoped()
}
]
}
]
} }
] ]
}, },
[ScopeNames.WITH_COMMENTS]: { [ScopeNames.WITH_COMMENTS]: {
include: [ include: [
{ {
model: () => VideoCommentModel model: () => VideoCommentModel.unscoped()
} }
] ]
} }