Fix join in video events

pull/125/head
Chocobozzz 2017-10-26 11:42:36 +02:00
parent a041b17147
commit b869d19068
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 20 additions and 10 deletions

View File

@ -100,6 +100,9 @@ listWithLimitAndRandom = function (limitPods: number, limitRequestsPerPod: numbe
include: [
{
model: RequestVideoEvent['sequelize'].models.Video,
include: [
{
model: RequestVideoEvent['sequelize'].models.VideoChannel,
include: [
{
model: RequestVideoEvent['sequelize'].models.Author,
@ -118,6 +121,8 @@ listWithLimitAndRandom = function (limitPods: number, limitRequestsPerPod: numbe
}
]
}
]
}
return RequestVideoEvent.findAll(query).then(requests => {
const requestsGrouped = groupAndTruncateRequests(requests, limitRequestsPerPod)
@ -136,6 +141,9 @@ removeByRequestIdsAndPod = function (ids: number[], podId: number) {
include: [
{
model: RequestVideoEvent['sequelize'].models.Video,
include: [
{
model: RequestVideoEvent['sequelize'].models.VideoChannel,
include: [
{
model: RequestVideoEvent['sequelize'].models.Author,
@ -147,6 +155,8 @@ removeByRequestIdsAndPod = function (ids: number[], podId: number) {
}
]
}
]
}
return RequestVideoEvent.destroy(query)
}