aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-26 11:42:36 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-26 11:42:36 +0200
commitb869d19068f42eb2b7bc33e1e2bff10bd07f3fda (patch)
treeed65ab3a1f6b261e93864caac716df8cb922d997
parenta041b1714715593b46805d7fd0106501770d11c3 (diff)
downloadPeerTube-b869d19068f42eb2b7bc33e1e2bff10bd07f3fda.tar.gz
PeerTube-b869d19068f42eb2b7bc33e1e2bff10bd07f3fda.tar.zst
PeerTube-b869d19068f42eb2b7bc33e1e2bff10bd07f3fda.zip
Fix join in video events
-rw-r--r--server/models/request/request-video-event.ts30
1 files changed, 20 insertions, 10 deletions
diff --git a/server/models/request/request-video-event.ts b/server/models/request/request-video-event.ts
index 34d5c7162..d7dce9bc8 100644
--- a/server/models/request/request-video-event.ts
+++ b/server/models/request/request-video-event.ts
@@ -102,15 +102,20 @@ listWithLimitAndRandom = function (limitPods: number, limitRequestsPerPod: numbe
102 model: RequestVideoEvent['sequelize'].models.Video, 102 model: RequestVideoEvent['sequelize'].models.Video,
103 include: [ 103 include: [
104 { 104 {
105 model: RequestVideoEvent['sequelize'].models.Author, 105 model: RequestVideoEvent['sequelize'].models.VideoChannel,
106 include: [ 106 include: [
107 { 107 {
108 model: RequestVideoEvent['sequelize'].models.Pod, 108 model: RequestVideoEvent['sequelize'].models.Author,
109 where: { 109 include: [
110 id: { 110 {
111 $in: podIds 111 model: RequestVideoEvent['sequelize'].models.Pod,
112 where: {
113 id: {
114 $in: podIds
115 }
116 }
112 } 117 }
113 } 118 ]
114 } 119 }
115 ] 120 ]
116 } 121 }
@@ -138,10 +143,15 @@ removeByRequestIdsAndPod = function (ids: number[], podId: number) {
138 model: RequestVideoEvent['sequelize'].models.Video, 143 model: RequestVideoEvent['sequelize'].models.Video,
139 include: [ 144 include: [
140 { 145 {
141 model: RequestVideoEvent['sequelize'].models.Author, 146 model: RequestVideoEvent['sequelize'].models.VideoChannel,
142 where: { 147 include: [
143 podId 148 {
144 } 149 model: RequestVideoEvent['sequelize'].models.Author,
150 where: {
151 podId
152 }
153 }
154 ]
145 } 155 }
146 ] 156 ]
147 } 157 }