From 72c7248b6fdcdb2175e726ff51b42e7555f2bd84 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 24 Oct 2017 19:41:09 +0200 Subject: Add video channels --- server/models/request/request-video-event.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'server/models/request') diff --git a/server/models/request/request-video-event.ts b/server/models/request/request-video-event.ts index 4862a5745..34d5c7162 100644 --- a/server/models/request/request-video-event.ts +++ b/server/models/request/request-video-event.ts @@ -85,7 +85,8 @@ listWithLimitAndRandom = function (limitPods: number, limitRequestsPerPod: numbe const Pod = db.Pod // We make a join between videos and authors to find the podId of our video event requests - const podJoins = 'INNER JOIN "Videos" ON "Videos"."authorId" = "Authors"."id" ' + + const podJoins = 'INNER JOIN "VideoChannels" ON "VideoChannels"."authorId" = "Authors"."id" ' + + 'INNER JOIN "Videos" ON "Videos"."channelId" = "VideoChannels"."id" ' + 'INNER JOIN "RequestVideoEvents" ON "RequestVideoEvents"."videoId" = "Videos"."id"' return Pod.listRandomPodIdsWithRequest(limitPods, 'Authors', podJoins).then(podIds => { @@ -161,7 +162,7 @@ function groupAndTruncateRequests (events: RequestVideoEventInstance[], limitReq const eventsGrouped: RequestsVideoEventGrouped = {} events.forEach(event => { - const pod = event.Video.Author.Pod + const pod = event.Video.VideoChannel.Author.Pod if (!eventsGrouped[pod.id]) eventsGrouped[pod.id] = [] -- cgit v1.2.3