diff options
author | Chocobozzz <me@florianbigard.com> | 2018-06-13 17:43:30 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-06-13 18:07:35 +0200 |
commit | 9a4a9b6c4e193739d542f73ee85cd305067f2aea (patch) | |
tree | df9b719142dc098764c7a7878a086880b8f9e6bf | |
parent | 4555697f216e894e5651d8f6d3d971e7d0c17d17 (diff) | |
download | PeerTube-9a4a9b6c4e193739d542f73ee85cd305067f2aea.tar.gz PeerTube-9a4a9b6c4e193739d542f73ee85cd305067f2aea.tar.zst PeerTube-9a4a9b6c4e193739d542f73ee85cd305067f2aea.zip |
Fix offset/limit on some SQL queries :facepalm:
-rw-r--r-- | server/models/account/account-video-rate.ts | 4 | ||||
-rw-r--r-- | server/models/video/video-comment.ts | 8 | ||||
-rw-r--r-- | server/models/video/video-share.ts | 4 | ||||
-rw-r--r-- | server/tests/api/server/handle-down.ts | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/server/models/account/account-video-rate.ts b/server/models/account/account-video-rate.ts index 508ab814f..9c19ec748 100644 --- a/server/models/account/account-video-rate.ts +++ b/server/models/account/account-video-rate.ts | |||
@@ -70,8 +70,8 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> { | |||
70 | 70 | ||
71 | static listAndCountAccountUrlsByVideoId (rateType: VideoRateType, videoId: number, start: number, count: number, t?: Transaction) { | 71 | static listAndCountAccountUrlsByVideoId (rateType: VideoRateType, videoId: number, start: number, count: number, t?: Transaction) { |
72 | const query = { | 72 | const query = { |
73 | start, | 73 | offset: start, |
74 | count, | 74 | limit: count, |
75 | where: { | 75 | where: { |
76 | videoId, | 76 | videoId, |
77 | type: rateType | 77 | type: rateType |
diff --git a/server/models/video/video-comment.ts b/server/models/video/video-comment.ts index 353fb1a0e..86766a5d1 100644 --- a/server/models/video/video-comment.ts +++ b/server/models/video/video-comment.ts | |||
@@ -329,8 +329,8 @@ export class VideoCommentModel extends Model<VideoCommentModel> { | |||
329 | static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction, order: 'ASC' | 'DESC' = 'ASC') { | 329 | static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction, order: 'ASC' | 'DESC' = 'ASC') { |
330 | const query = { | 330 | const query = { |
331 | order: [ [ 'createdAt', order ] ], | 331 | order: [ [ 'createdAt', order ] ], |
332 | start, | 332 | offset: start, |
333 | count, | 333 | limit: count, |
334 | where: { | 334 | where: { |
335 | videoId | 335 | videoId |
336 | }, | 336 | }, |
@@ -343,8 +343,8 @@ export class VideoCommentModel extends Model<VideoCommentModel> { | |||
343 | static listForFeed (start: number, count: number, videoId?: number) { | 343 | static listForFeed (start: number, count: number, videoId?: number) { |
344 | const query = { | 344 | const query = { |
345 | order: [ [ 'createdAt', 'DESC' ] ], | 345 | order: [ [ 'createdAt', 'DESC' ] ], |
346 | start, | 346 | offset: start, |
347 | count, | 347 | limit: count, |
348 | where: {}, | 348 | where: {}, |
349 | include: [ | 349 | include: [ |
350 | { | 350 | { |
diff --git a/server/models/video/video-share.ts b/server/models/video/video-share.ts index 15dba3f7d..fa9a70d50 100644 --- a/server/models/video/video-share.ts +++ b/server/models/video/video-share.ts | |||
@@ -190,8 +190,8 @@ export class VideoShareModel extends Model<VideoShareModel> { | |||
190 | 190 | ||
191 | static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction) { | 191 | static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction) { |
192 | const query = { | 192 | const query = { |
193 | start, | 193 | offset: start, |
194 | count, | 194 | limit: count, |
195 | where: { | 195 | where: { |
196 | videoId | 196 | videoId |
197 | }, | 197 | }, |
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index 55705caca..69609b4fc 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts | |||
@@ -138,7 +138,7 @@ describe('Test handle downs', function () { | |||
138 | 138 | ||
139 | await waitJobs(servers[0]) | 139 | await waitJobs(servers[0]) |
140 | // Wait scheduler | 140 | // Wait scheduler |
141 | await wait(3000) | 141 | await wait(11000) |
142 | 142 | ||
143 | const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 1, 'createdAt') | 143 | const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 1, 'createdAt') |
144 | expect(res.body.data).to.be.an('array') | 144 | expect(res.body.data).to.be.an('array') |