]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix offset/limit on some SQL queries :facepalm:
authorChocobozzz <me@florianbigard.com>
Wed, 13 Jun 2018 15:43:30 +0000 (17:43 +0200)
committerChocobozzz <me@florianbigard.com>
Wed, 13 Jun 2018 16:07:35 +0000 (18:07 +0200)
server/models/account/account-video-rate.ts
server/models/video/video-comment.ts
server/models/video/video-share.ts
server/tests/api/server/handle-down.ts

index 508ab814f93fe34f94031f477dafcef90a0fa32d..9c19ec7488d46bc269fe281f101a24a94197c456 100644 (file)
@@ -70,8 +70,8 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {
 
   static listAndCountAccountUrlsByVideoId (rateType: VideoRateType, videoId: number, start: number, count: number, t?: Transaction) {
     const query = {
-      start,
-      count,
+      offset: start,
+      limit: count,
       where: {
         videoId,
         type: rateType
index 353fb1a0eb947cbee47b8ef28d9b88242c10f5d4..86766a5d1edc841c49139e966fe0ac9ae8443bcb 100644 (file)
@@ -329,8 +329,8 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
   static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction, order: 'ASC' | 'DESC' = 'ASC') {
     const query = {
       order: [ [ 'createdAt', order ] ],
-      start,
-      count,
+      offset: start,
+      limit: count,
       where: {
         videoId
       },
@@ -343,8 +343,8 @@ export class VideoCommentModel extends Model<VideoCommentModel> {
   static listForFeed (start: number, count: number, videoId?: number) {
     const query = {
       order: [ [ 'createdAt', 'DESC' ] ],
-      start,
-      count,
+      offset: start,
+      limit: count,
       where: {},
       include: [
         {
index 15dba3f7d91bd8a0495581c561d748f6eece36d7..fa9a70d509b42fccb99a59e8a10b9139a91f8b15 100644 (file)
@@ -190,8 +190,8 @@ export class VideoShareModel extends Model<VideoShareModel> {
 
   static listAndCountByVideoId (videoId: number, start: number, count: number, t?: Sequelize.Transaction) {
     const query = {
-      start,
-      count,
+      offset: start,
+      limit: count,
       where: {
         videoId
       },
index 55705caca71407eb230b6654ed1f61f1c9148a6f..69609b4fc5d1c1d85c20316f142e6f703d8ee0c0 100644 (file)
@@ -138,7 +138,7 @@ describe('Test handle downs', function () {
 
     await waitJobs(servers[0])
     // Wait scheduler
-    await wait(3000)
+    await wait(11000)
 
     const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 1, 'createdAt')
     expect(res.body.data).to.be.an('array')