From 081a14d6f3ca3664aabdd06aaf06080dcba17c25 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 8 Jul 2023 16:53:07 +0900 Subject: [PATCH] perf(backend): use limit() instead of take() --- CHANGELOG.md | 1 + packages/backend/src/core/SearchService.ts | 2 +- packages/backend/src/server/ActivityPubServerService.ts | 2 +- .../src/server/api/endpoints/admin/abuse-user-reports.ts | 2 +- packages/backend/src/server/api/endpoints/admin/ad/list.ts | 2 +- .../src/server/api/endpoints/admin/announcements/list.ts | 2 +- .../backend/src/server/api/endpoints/admin/drive/files.ts | 2 +- .../src/server/api/endpoints/admin/emoji/list-remote.ts | 2 +- .../backend/src/server/api/endpoints/admin/emoji/list.ts | 4 ++-- .../backend/src/server/api/endpoints/admin/roles/users.ts | 2 +- .../src/server/api/endpoints/admin/show-moderation-logs.ts | 2 +- .../backend/src/server/api/endpoints/admin/show-users.ts | 2 +- packages/backend/src/server/api/endpoints/announcements.ts | 2 +- packages/backend/src/server/api/endpoints/blocking/list.ts | 2 +- .../backend/src/server/api/endpoints/channels/featured.ts | 2 +- .../backend/src/server/api/endpoints/channels/followed.ts | 2 +- packages/backend/src/server/api/endpoints/channels/owned.ts | 2 +- .../backend/src/server/api/endpoints/channels/search.ts | 2 +- .../backend/src/server/api/endpoints/channels/timeline.ts | 2 +- packages/backend/src/server/api/endpoints/clips/notes.ts | 2 +- packages/backend/src/server/api/endpoints/drive/files.ts | 2 +- packages/backend/src/server/api/endpoints/drive/folders.ts | 2 +- packages/backend/src/server/api/endpoints/drive/stream.ts | 2 +- .../src/server/api/endpoints/federation/followers.ts | 2 +- .../src/server/api/endpoints/federation/following.ts | 2 +- .../src/server/api/endpoints/federation/instances.ts | 2 +- .../backend/src/server/api/endpoints/federation/users.ts | 2 +- packages/backend/src/server/api/endpoints/flash/featured.ts | 2 +- packages/backend/src/server/api/endpoints/flash/my-likes.ts | 2 +- packages/backend/src/server/api/endpoints/flash/my.ts | 2 +- .../src/server/api/endpoints/following/requests/list.ts | 2 +- .../backend/src/server/api/endpoints/gallery/featured.ts | 2 +- .../backend/src/server/api/endpoints/gallery/popular.ts | 2 +- packages/backend/src/server/api/endpoints/gallery/posts.ts | 2 +- packages/backend/src/server/api/endpoints/hashtags/list.ts | 2 +- .../backend/src/server/api/endpoints/hashtags/search.ts | 2 +- packages/backend/src/server/api/endpoints/hashtags/users.ts | 2 +- packages/backend/src/server/api/endpoints/i/favorites.ts | 2 +- .../backend/src/server/api/endpoints/i/gallery/likes.ts | 2 +- .../backend/src/server/api/endpoints/i/gallery/posts.ts | 2 +- packages/backend/src/server/api/endpoints/i/page-likes.ts | 2 +- packages/backend/src/server/api/endpoints/i/pages.ts | 2 +- .../backend/src/server/api/endpoints/i/signin-history.ts | 2 +- packages/backend/src/server/api/endpoints/mute/list.ts | 2 +- packages/backend/src/server/api/endpoints/notes.ts | 2 +- packages/backend/src/server/api/endpoints/notes/children.ts | 2 +- packages/backend/src/server/api/endpoints/notes/featured.ts | 2 +- .../src/server/api/endpoints/notes/global-timeline.ts | 2 +- .../src/server/api/endpoints/notes/hybrid-timeline.ts | 2 +- .../src/server/api/endpoints/notes/local-timeline.ts | 2 +- packages/backend/src/server/api/endpoints/notes/mentions.ts | 2 +- .../src/server/api/endpoints/notes/polls/recommendation.ts | 2 +- packages/backend/src/server/api/endpoints/notes/renotes.ts | 2 +- packages/backend/src/server/api/endpoints/notes/replies.ts | 2 +- .../backend/src/server/api/endpoints/notes/search-by-tag.ts | 2 +- packages/backend/src/server/api/endpoints/notes/timeline.ts | 2 +- .../src/server/api/endpoints/notes/user-list-timeline.ts | 2 +- packages/backend/src/server/api/endpoints/pages/featured.ts | 2 +- .../backend/src/server/api/endpoints/renote-mute/list.ts | 2 +- packages/backend/src/server/api/endpoints/roles/users.ts | 2 +- packages/backend/src/server/api/endpoints/users.ts | 2 +- packages/backend/src/server/api/endpoints/users/clips.ts | 2 +- .../backend/src/server/api/endpoints/users/followers.ts | 2 +- .../backend/src/server/api/endpoints/users/following.ts | 2 +- .../backend/src/server/api/endpoints/users/gallery/posts.ts | 2 +- packages/backend/src/server/api/endpoints/users/notes.ts | 2 +- packages/backend/src/server/api/endpoints/users/pages.ts | 2 +- .../backend/src/server/api/endpoints/users/reactions.ts | 2 +- .../src/server/api/endpoints/users/recommendation.ts | 2 +- .../api/endpoints/users/search-by-username-and-host.ts | 6 +++--- packages/backend/src/server/api/endpoints/users/search.ts | 6 +++--- 71 files changed, 76 insertions(+), 75 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 905c2ea2de..a271902159 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ - JSON.parse の回数を削減することで、ストリーミングのパフォーマンスを向上しました - nsfwjs のモデルロードを排他することで、重複ロードによってメモリ使用量が増加しないように - 連合の配送ジョブのパフォーマンスを向上(ロック機構の見直し、Redisキャッシュの活用) +- 全体的なDBクエリのパフォーマンスを向上 ## 13.13.2 diff --git a/packages/backend/src/core/SearchService.ts b/packages/backend/src/core/SearchService.ts index 9502afcc9b..956c4cc09c 100644 --- a/packages/backend/src/core/SearchService.ts +++ b/packages/backend/src/core/SearchService.ts @@ -174,7 +174,7 @@ export class SearchService { if (me) this.queryService.generateMutedUserQuery(query, me); if (me) this.queryService.generateBlockedUserQuery(query, me); - return await query.take(pagination.limit).getMany(); + return await query.limit(pagination.limit).getMany(); } } } diff --git a/packages/backend/src/server/ActivityPubServerService.ts b/packages/backend/src/server/ActivityPubServerService.ts index 455acd1e47..f53351d999 100644 --- a/packages/backend/src/server/ActivityPubServerService.ts +++ b/packages/backend/src/server/ActivityPubServerService.ts @@ -369,7 +369,7 @@ export class ActivityPubServerService { })) .andWhere('note.localOnly = FALSE'); - const notes = await query.take(limit).getMany(); + const notes = await query.limit(limit).getMany(); if (sinceId) notes.reverse(); diff --git a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts index 9bba16166f..b8ea74b7c5 100644 --- a/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts +++ b/packages/backend/src/server/api/endpoints/admin/abuse-user-reports.ts @@ -115,7 +115,7 @@ export default class extends Endpoint { case 'remote': query.andWhere('report.targetUserHost IS NOT NULL'); break; } - const reports = await query.take(ps.limit).getMany(); + const reports = await query.limit(ps.limit).getMany(); return await this.abuseUserReportEntityService.packMany(reports); }); diff --git a/packages/backend/src/server/api/endpoints/admin/ad/list.ts b/packages/backend/src/server/api/endpoints/admin/ad/list.ts index 0b6d006052..725ddb58be 100644 --- a/packages/backend/src/server/api/endpoints/admin/ad/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/ad/list.ts @@ -32,7 +32,7 @@ export default class extends Endpoint { ) { super(meta, paramDef, async (ps, me) => { const query = this.queryService.makePaginationQuery(this.adsRepository.createQueryBuilder('ad'), ps.sinceId, ps.untilId); - const ads = await query.take(ps.limit).getMany(); + const ads = await query.limit(ps.limit).getMany(); return ads; }); diff --git a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts index 9b20494129..11231f6e04 100644 --- a/packages/backend/src/server/api/endpoints/admin/announcements/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/announcements/list.ts @@ -80,7 +80,7 @@ export default class extends Endpoint { super(meta, paramDef, async (ps, me) => { const query = this.queryService.makePaginationQuery(this.announcementsRepository.createQueryBuilder('announcement'), ps.sinceId, ps.untilId); - const announcements = await query.take(ps.limit).getMany(); + const announcements = await query.limit(ps.limit).getMany(); const reads = new Map(); diff --git a/packages/backend/src/server/api/endpoints/admin/drive/files.ts b/packages/backend/src/server/api/endpoints/admin/drive/files.ts index 8a4498d5fa..2901fdb774 100644 --- a/packages/backend/src/server/api/endpoints/admin/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/admin/drive/files.ts @@ -76,7 +76,7 @@ export default class extends Endpoint { } } - const files = await query.take(ps.limit).getMany(); + const files = await query.limit(ps.limit).getMany(); return await this.driveFileEntityService.packMany(files, { detail: true, withUser: true, self: true }); }); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts index df3c28deff..8d50413e95 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list-remote.ts @@ -98,7 +98,7 @@ export default class extends Endpoint { const emojis = await q .orderBy('emoji.id', 'DESC') - .take(ps.limit) + .limit(ps.limit) .getMany(); return this.emojiEntityService.packDetailedMany(emojis); diff --git a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts index 1a6a361683..80acdd1910 100644 --- a/packages/backend/src/server/api/endpoints/admin/emoji/list.ts +++ b/packages/backend/src/server/api/endpoints/admin/emoji/list.ts @@ -84,7 +84,7 @@ export default class extends Endpoint { if (ps.query) { //q.andWhere('emoji.name ILIKE :q', { q: `%${ sqlLikeEscape(ps.query) }%` }); - //const emojis = await q.take(ps.limit).getMany(); + //const emojis = await q.limit(ps.limit).getMany(); emojis = await q.getMany(); const queryarry = ps.query.match(/\:([a-z0-9_]*)\:/g); @@ -101,7 +101,7 @@ export default class extends Endpoint { } emojis.splice(ps.limit + 1); } else { - emojis = await q.take(ps.limit).getMany(); + emojis = await q.limit(ps.limit).getMany(); } return this.emojiEntityService.packDetailedMany(emojis); diff --git a/packages/backend/src/server/api/endpoints/admin/roles/users.ts b/packages/backend/src/server/api/endpoints/admin/roles/users.ts index 35edca5460..63650bb2bf 100644 --- a/packages/backend/src/server/api/endpoints/admin/roles/users.ts +++ b/packages/backend/src/server/api/endpoints/admin/roles/users.ts @@ -64,7 +64,7 @@ export default class extends Endpoint { .innerJoinAndSelect('assign.user', 'user'); const assigns = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await Promise.all(assigns.map(async assign => ({ diff --git a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts index 24335a21cc..69c95ef19c 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-moderation-logs.ts @@ -74,7 +74,7 @@ export default class extends Endpoint { super(meta, paramDef, async (ps, me) => { const query = this.queryService.makePaginationQuery(this.moderationLogsRepository.createQueryBuilder('report'), ps.sinceId, ps.untilId); - const reports = await query.take(ps.limit).getMany(); + const reports = await query.limit(ps.limit).getMany(); return await this.moderationLogEntityService.packMany(reports); }); diff --git a/packages/backend/src/server/api/endpoints/admin/show-users.ts b/packages/backend/src/server/api/endpoints/admin/show-users.ts index 426973f282..0a150d1dfd 100644 --- a/packages/backend/src/server/api/endpoints/admin/show-users.ts +++ b/packages/backend/src/server/api/endpoints/admin/show-users.ts @@ -104,7 +104,7 @@ export default class extends Endpoint { default: query.orderBy('user.id', 'ASC'); break; } - query.take(ps.limit); + query.limit(ps.limit); query.skip(ps.offset); const users = await query.getMany(); diff --git a/packages/backend/src/server/api/endpoints/announcements.ts b/packages/backend/src/server/api/endpoints/announcements.ts index 79788be4e2..735af51ee2 100644 --- a/packages/backend/src/server/api/endpoints/announcements.ts +++ b/packages/backend/src/server/api/endpoints/announcements.ts @@ -79,7 +79,7 @@ export default class extends Endpoint { super(meta, paramDef, async (ps, me) => { const query = this.queryService.makePaginationQuery(this.announcementsRepository.createQueryBuilder('announcement'), ps.sinceId, ps.untilId); - const announcements = await query.take(ps.limit).getMany(); + const announcements = await query.limit(ps.limit).getMany(); if (me) { const reads = (await this.announcementReadsRepository.findBy({ diff --git a/packages/backend/src/server/api/endpoints/blocking/list.ts b/packages/backend/src/server/api/endpoints/blocking/list.ts index 969aae06f9..d61bb0d214 100644 --- a/packages/backend/src/server/api/endpoints/blocking/list.ts +++ b/packages/backend/src/server/api/endpoints/blocking/list.ts @@ -48,7 +48,7 @@ export default class extends Endpoint { .andWhere('blocking.blockerId = :meId', { meId: me.id }); const blockings = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.blockingEntityService.packMany(blockings, me); diff --git a/packages/backend/src/server/api/endpoints/channels/featured.ts b/packages/backend/src/server/api/endpoints/channels/featured.ts index 1a8d1164c7..953f027aa2 100644 --- a/packages/backend/src/server/api/endpoints/channels/featured.ts +++ b/packages/backend/src/server/api/endpoints/channels/featured.ts @@ -41,7 +41,7 @@ export default class extends Endpoint { .andWhere('channel.isArchived = FALSE') .orderBy('channel.lastNotedAt', 'DESC'); - const channels = await query.take(10).getMany(); + const channels = await query.limit(10).getMany(); return await Promise.all(channels.map(x => this.channelEntityService.pack(x, me))); }); diff --git a/packages/backend/src/server/api/endpoints/channels/followed.ts b/packages/backend/src/server/api/endpoints/channels/followed.ts index f49f3105d5..a1656903aa 100644 --- a/packages/backend/src/server/api/endpoints/channels/followed.ts +++ b/packages/backend/src/server/api/endpoints/channels/followed.ts @@ -48,7 +48,7 @@ export default class extends Endpoint { .andWhere({ followerId: me.id }); const followings = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await Promise.all(followings.map(x => this.channelEntityService.pack(x.followeeId, me))); diff --git a/packages/backend/src/server/api/endpoints/channels/owned.ts b/packages/backend/src/server/api/endpoints/channels/owned.ts index 8fae972cb1..4561bb2e94 100644 --- a/packages/backend/src/server/api/endpoints/channels/owned.ts +++ b/packages/backend/src/server/api/endpoints/channels/owned.ts @@ -49,7 +49,7 @@ export default class extends Endpoint { .andWhere({ userId: me.id }); const channels = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await Promise.all(channels.map(x => this.channelEntityService.pack(x, me))); diff --git a/packages/backend/src/server/api/endpoints/channels/search.ts b/packages/backend/src/server/api/endpoints/channels/search.ts index a3b40b0bbd..dfb6937964 100644 --- a/packages/backend/src/server/api/endpoints/channels/search.ts +++ b/packages/backend/src/server/api/endpoints/channels/search.ts @@ -61,7 +61,7 @@ export default class extends Endpoint { } const channels = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await Promise.all(channels.map(x => this.channelEntityService.pack(x, me))); diff --git a/packages/backend/src/server/api/endpoints/channels/timeline.ts b/packages/backend/src/server/api/endpoints/channels/timeline.ts index 833bd63c1c..e3119cc40f 100644 --- a/packages/backend/src/server/api/endpoints/channels/timeline.ts +++ b/packages/backend/src/server/api/endpoints/channels/timeline.ts @@ -105,7 +105,7 @@ export default class extends Endpoint { } //#endregion - timeline = await query.take(ps.limit).getMany(); + timeline = await query.limit(ps.limit).getMany(); } else { const noteIds = noteIdsRes.map(x => x[1][1]).filter(x => x !== ps.untilId); diff --git a/packages/backend/src/server/api/endpoints/clips/notes.ts b/packages/backend/src/server/api/endpoints/clips/notes.ts index dcb415b752..49607babee 100644 --- a/packages/backend/src/server/api/endpoints/clips/notes.ts +++ b/packages/backend/src/server/api/endpoints/clips/notes.ts @@ -88,7 +88,7 @@ export default class extends Endpoint { } const notes = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.noteEntityService.packMany(notes, me); diff --git a/packages/backend/src/server/api/endpoints/drive/files.ts b/packages/backend/src/server/api/endpoints/drive/files.ts index 4609307774..f4343248b8 100644 --- a/packages/backend/src/server/api/endpoints/drive/files.ts +++ b/packages/backend/src/server/api/endpoints/drive/files.ts @@ -73,7 +73,7 @@ export default class extends Endpoint { case '-size': query.orderBy('file.size', 'ASC'); break; } - const files = await query.take(ps.limit).getMany(); + const files = await query.limit(ps.limit).getMany(); return await this.driveFileEntityService.packMany(files, { detail: false, self: true }); }); diff --git a/packages/backend/src/server/api/endpoints/drive/folders.ts b/packages/backend/src/server/api/endpoints/drive/folders.ts index b41eaf4463..eb674f3e15 100644 --- a/packages/backend/src/server/api/endpoints/drive/folders.ts +++ b/packages/backend/src/server/api/endpoints/drive/folders.ts @@ -54,7 +54,7 @@ export default class extends Endpoint { query.andWhere('folder.parentId IS NULL'); } - const folders = await query.take(ps.limit).getMany(); + const folders = await query.limit(ps.limit).getMany(); return await Promise.all(folders.map(folder => this.driveFolderEntityService.pack(folder))); }); diff --git a/packages/backend/src/server/api/endpoints/drive/stream.ts b/packages/backend/src/server/api/endpoints/drive/stream.ts index 61bcfea0c3..a1c14a8e3f 100644 --- a/packages/backend/src/server/api/endpoints/drive/stream.ts +++ b/packages/backend/src/server/api/endpoints/drive/stream.ts @@ -56,7 +56,7 @@ export default class extends Endpoint { } } - const files = await query.take(ps.limit).getMany(); + const files = await query.limit(ps.limit).getMany(); return await this.driveFileEntityService.packMany(files, { detail: false, self: true }); }); diff --git a/packages/backend/src/server/api/endpoints/federation/followers.ts b/packages/backend/src/server/api/endpoints/federation/followers.ts index be1d6c8e58..1b2f9446f8 100644 --- a/packages/backend/src/server/api/endpoints/federation/followers.ts +++ b/packages/backend/src/server/api/endpoints/federation/followers.ts @@ -47,7 +47,7 @@ export default class extends Endpoint { .andWhere('following.followeeHost = :host', { host: ps.host }); const followings = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.followingEntityService.packMany(followings, me, { populateFollowee: true }); diff --git a/packages/backend/src/server/api/endpoints/federation/following.ts b/packages/backend/src/server/api/endpoints/federation/following.ts index 74656ce863..c5aa1ec60b 100644 --- a/packages/backend/src/server/api/endpoints/federation/following.ts +++ b/packages/backend/src/server/api/endpoints/federation/following.ts @@ -47,7 +47,7 @@ export default class extends Endpoint { .andWhere('following.followerHost = :host', { host: ps.host }); const followings = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.followingEntityService.packMany(followings, me, { populateFollowee: true }); diff --git a/packages/backend/src/server/api/endpoints/federation/instances.ts b/packages/backend/src/server/api/endpoints/federation/instances.ts index 061c6eb5be..ddf1a178b1 100644 --- a/packages/backend/src/server/api/endpoints/federation/instances.ts +++ b/packages/backend/src/server/api/endpoints/federation/instances.ts @@ -126,7 +126,7 @@ export default class extends Endpoint { query.andWhere('instance.host like :host', { host: '%' + sqlLikeEscape(ps.host.toLowerCase()) + '%' }); } - const instances = await query.take(ps.limit).skip(ps.offset).getMany(); + const instances = await query.limit(ps.limit).skip(ps.offset).getMany(); return await this.instanceEntityService.packMany(instances); }); diff --git a/packages/backend/src/server/api/endpoints/federation/users.ts b/packages/backend/src/server/api/endpoints/federation/users.ts index a028930f21..06f252005b 100644 --- a/packages/backend/src/server/api/endpoints/federation/users.ts +++ b/packages/backend/src/server/api/endpoints/federation/users.ts @@ -47,7 +47,7 @@ export default class extends Endpoint { .andWhere('user.host = :host', { host: ps.host }); const users = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.userEntityService.packMany(users, me, { detail: true }); diff --git a/packages/backend/src/server/api/endpoints/flash/featured.ts b/packages/backend/src/server/api/endpoints/flash/featured.ts index 570aef96d2..99c8763b11 100644 --- a/packages/backend/src/server/api/endpoints/flash/featured.ts +++ b/packages/backend/src/server/api/endpoints/flash/featured.ts @@ -40,7 +40,7 @@ export default class extends Endpoint { .andWhere('flash.likedCount > 0') .orderBy('flash.likedCount', 'DESC'); - const flashs = await query.take(10).getMany(); + const flashs = await query.limit(10).getMany(); return await this.flashEntityService.packMany(flashs, me); }); diff --git a/packages/backend/src/server/api/endpoints/flash/my-likes.ts b/packages/backend/src/server/api/endpoints/flash/my-likes.ts index f7716ea74a..7d1149ada9 100644 --- a/packages/backend/src/server/api/endpoints/flash/my-likes.ts +++ b/packages/backend/src/server/api/endpoints/flash/my-likes.ts @@ -59,7 +59,7 @@ export default class extends Endpoint { .leftJoinAndSelect('like.flash', 'flash'); const likes = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return this.flashLikeEntityService.packMany(likes, me); diff --git a/packages/backend/src/server/api/endpoints/flash/my.ts b/packages/backend/src/server/api/endpoints/flash/my.ts index baed7f000f..45a3b50e08 100644 --- a/packages/backend/src/server/api/endpoints/flash/my.ts +++ b/packages/backend/src/server/api/endpoints/flash/my.ts @@ -48,7 +48,7 @@ export default class extends Endpoint { .andWhere('flash.userId = :meId', { meId: me.id }); const flashs = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.flashEntityService.packMany(flashs); diff --git a/packages/backend/src/server/api/endpoints/following/requests/list.ts b/packages/backend/src/server/api/endpoints/following/requests/list.ts index d68248fab9..29588e8731 100644 --- a/packages/backend/src/server/api/endpoints/following/requests/list.ts +++ b/packages/backend/src/server/api/endpoints/following/requests/list.ts @@ -64,7 +64,7 @@ export default class extends Endpoint { .andWhere('request.followeeId = :meId', { meId: me.id }); const requests = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await Promise.all(requests.map(req => this.followRequestEntityService.pack(req))); diff --git a/packages/backend/src/server/api/endpoints/gallery/featured.ts b/packages/backend/src/server/api/endpoints/gallery/featured.ts index 9994ce90d7..46347247f0 100644 --- a/packages/backend/src/server/api/endpoints/gallery/featured.ts +++ b/packages/backend/src/server/api/endpoints/gallery/featured.ts @@ -41,7 +41,7 @@ export default class extends Endpoint { .andWhere('post.likedCount > 0') .orderBy('post.likedCount', 'DESC'); - const posts = await query.take(10).getMany(); + const posts = await query.limit(10).getMany(); return await this.galleryPostEntityService.packMany(posts, me); }); diff --git a/packages/backend/src/server/api/endpoints/gallery/popular.ts b/packages/backend/src/server/api/endpoints/gallery/popular.ts index 55d3dabfb0..4ee3d68a92 100644 --- a/packages/backend/src/server/api/endpoints/gallery/popular.ts +++ b/packages/backend/src/server/api/endpoints/gallery/popular.ts @@ -40,7 +40,7 @@ export default class extends Endpoint { .andWhere('post.likedCount > 0') .orderBy('post.likedCount', 'DESC'); - const posts = await query.take(10).getMany(); + const posts = await query.limit(10).getMany(); return await this.galleryPostEntityService.packMany(posts, me); }); diff --git a/packages/backend/src/server/api/endpoints/gallery/posts.ts b/packages/backend/src/server/api/endpoints/gallery/posts.ts index e94003eb79..b9aac3fb34 100644 --- a/packages/backend/src/server/api/endpoints/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/gallery/posts.ts @@ -43,7 +43,7 @@ export default class extends Endpoint { const query = this.queryService.makePaginationQuery(this.galleryPostsRepository.createQueryBuilder('post'), ps.sinceId, ps.untilId) .innerJoinAndSelect('post.user', 'user'); - const posts = await query.take(ps.limit).getMany(); + const posts = await query.limit(ps.limit).getMany(); return await this.galleryPostEntityService.packMany(posts, me); }); diff --git a/packages/backend/src/server/api/endpoints/hashtags/list.ts b/packages/backend/src/server/api/endpoints/hashtags/list.ts index 226a11de0b..693d938bf0 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/list.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/list.ts @@ -73,7 +73,7 @@ export default class extends Endpoint { 'tag.attachedRemoteUsersCount', ]); - const tags = await query.take(ps.limit).getMany(); + const tags = await query.limit(ps.limit).getMany(); return this.hashtagEntityService.packMany(tags); }); diff --git a/packages/backend/src/server/api/endpoints/hashtags/search.ts b/packages/backend/src/server/api/endpoints/hashtags/search.ts index 4f5f979767..e2e00def79 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/search.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/search.ts @@ -41,7 +41,7 @@ export default class extends Endpoint { .where('tag.name like :q', { q: sqlLikeEscape(ps.query.toLowerCase()) + '%' }) .orderBy('tag.count', 'DESC') .groupBy('tag.id') - .take(ps.limit) + .limit(ps.limit) .skip(ps.offset) .getMany(); diff --git a/packages/backend/src/server/api/endpoints/hashtags/users.ts b/packages/backend/src/server/api/endpoints/hashtags/users.ts index a86faf41a4..b00b005add 100644 --- a/packages/backend/src/server/api/endpoints/hashtags/users.ts +++ b/packages/backend/src/server/api/endpoints/hashtags/users.ts @@ -68,7 +68,7 @@ export default class extends Endpoint { case '-updatedAt': query.orderBy('user.updatedAt', 'ASC'); break; } - const users = await query.take(ps.limit).getMany(); + const users = await query.limit(ps.limit).getMany(); return await this.userEntityService.packMany(users, me, { detail: true }); }); diff --git a/packages/backend/src/server/api/endpoints/i/favorites.ts b/packages/backend/src/server/api/endpoints/i/favorites.ts index ce8ab4962a..bdfb63974a 100644 --- a/packages/backend/src/server/api/endpoints/i/favorites.ts +++ b/packages/backend/src/server/api/endpoints/i/favorites.ts @@ -49,7 +49,7 @@ export default class extends Endpoint { .leftJoinAndSelect('favorite.note', 'note'); const favorites = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.noteFavoriteEntityService.packMany(favorites, me); diff --git a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts index d1b04cb655..915639e5f7 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/likes.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/likes.ts @@ -60,7 +60,7 @@ export default class extends Endpoint { .leftJoinAndSelect('like.post', 'post'); const likes = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.galleryLikeEntityService.packMany(likes, me); diff --git a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts index 32d14293f7..5ba9afd4a8 100644 --- a/packages/backend/src/server/api/endpoints/i/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/i/gallery/posts.ts @@ -48,7 +48,7 @@ export default class extends Endpoint { .andWhere('post.userId = :meId', { meId: me.id }); const posts = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.galleryPostEntityService.packMany(posts, me); diff --git a/packages/backend/src/server/api/endpoints/i/page-likes.ts b/packages/backend/src/server/api/endpoints/i/page-likes.ts index 70e6e0a6a8..9f073ba596 100644 --- a/packages/backend/src/server/api/endpoints/i/page-likes.ts +++ b/packages/backend/src/server/api/endpoints/i/page-likes.ts @@ -59,7 +59,7 @@ export default class extends Endpoint { .leftJoinAndSelect('like.page', 'page'); const likes = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return this.pageLikeEntityService.packMany(likes, me); diff --git a/packages/backend/src/server/api/endpoints/i/pages.ts b/packages/backend/src/server/api/endpoints/i/pages.ts index 285aa34e91..772486befc 100644 --- a/packages/backend/src/server/api/endpoints/i/pages.ts +++ b/packages/backend/src/server/api/endpoints/i/pages.ts @@ -48,7 +48,7 @@ export default class extends Endpoint { .andWhere('page.userId = :meId', { meId: me.id }); const pages = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.pageEntityService.packMany(pages); diff --git a/packages/backend/src/server/api/endpoints/i/signin-history.ts b/packages/backend/src/server/api/endpoints/i/signin-history.ts index 9b30a24336..aa8cb5cf42 100644 --- a/packages/backend/src/server/api/endpoints/i/signin-history.ts +++ b/packages/backend/src/server/api/endpoints/i/signin-history.ts @@ -35,7 +35,7 @@ export default class extends Endpoint { const query = this.queryService.makePaginationQuery(this.signinsRepository.createQueryBuilder('signin'), ps.sinceId, ps.untilId) .andWhere('signin.userId = :meId', { meId: me.id }); - const history = await query.take(ps.limit).getMany(); + const history = await query.limit(ps.limit).getMany(); return await Promise.all(history.map(record => this.signinEntityService.pack(record))); }); diff --git a/packages/backend/src/server/api/endpoints/mute/list.ts b/packages/backend/src/server/api/endpoints/mute/list.ts index 9ec6d17273..4711e86d6b 100644 --- a/packages/backend/src/server/api/endpoints/mute/list.ts +++ b/packages/backend/src/server/api/endpoints/mute/list.ts @@ -48,7 +48,7 @@ export default class extends Endpoint { .andWhere('muting.muterId = :meId', { meId: me.id }); const mutings = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.mutingEntityService.packMany(mutings, me); diff --git a/packages/backend/src/server/api/endpoints/notes.ts b/packages/backend/src/server/api/endpoints/notes.ts index a6e9707d38..9013b300e7 100644 --- a/packages/backend/src/server/api/endpoints/notes.ts +++ b/packages/backend/src/server/api/endpoints/notes.ts @@ -79,7 +79,7 @@ export default class extends Endpoint { // query.isBot = bot; //} - const notes = await query.take(ps.limit).getMany(); + const notes = await query.limit(ps.limit).getMany(); return await this.noteEntityService.packMany(notes); }); diff --git a/packages/backend/src/server/api/endpoints/notes/children.ts b/packages/backend/src/server/api/endpoints/notes/children.ts index 26f2d6772d..5f03fd4b74 100644 --- a/packages/backend/src/server/api/endpoints/notes/children.ts +++ b/packages/backend/src/server/api/endpoints/notes/children.ts @@ -68,7 +68,7 @@ export default class extends Endpoint { this.queryService.generateBlockedUserQuery(query, me); } - const notes = await query.take(ps.limit).getMany(); + const notes = await query.limit(ps.limit).getMany(); return await this.noteEntityService.packMany(notes, me); }); diff --git a/packages/backend/src/server/api/endpoints/notes/featured.ts b/packages/backend/src/server/api/endpoints/notes/featured.ts index bdb06498bc..3a3cb0739b 100644 --- a/packages/backend/src/server/api/endpoints/notes/featured.ts +++ b/packages/backend/src/server/api/endpoints/notes/featured.ts @@ -65,7 +65,7 @@ export default class extends Endpoint { let notes = await query .orderBy('note.score', 'DESC') - .take(100) + .limit(100) .getMany(); notes.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()); diff --git a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts index 88c1ca7f58..4ce2fdaec7 100644 --- a/packages/backend/src/server/api/endpoints/notes/global-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/global-timeline.ts @@ -88,7 +88,7 @@ export default class extends Endpoint { } //#endregion - const timeline = await query.take(ps.limit).getMany(); + const timeline = await query.limit(ps.limit).getMany(); process.nextTick(() => { if (me) { diff --git a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts index 7a3581e6e4..af94cf6087 100644 --- a/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/hybrid-timeline.ts @@ -137,7 +137,7 @@ export default class extends Endpoint { } //#endregion - const timeline = await query.take(ps.limit).getMany(); + const timeline = await query.limit(ps.limit).getMany(); process.nextTick(() => { this.activeUsersChart.read(me); diff --git a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts index 2ee549232c..fe7407f48a 100644 --- a/packages/backend/src/server/api/endpoints/notes/local-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/local-timeline.ts @@ -110,7 +110,7 @@ export default class extends Endpoint { } //#endregion - const timeline = await query.take(ps.limit).getMany(); + const timeline = await query.limit(ps.limit).getMany(); process.nextTick(() => { if (me) { diff --git a/packages/backend/src/server/api/endpoints/notes/mentions.ts b/packages/backend/src/server/api/endpoints/notes/mentions.ts index 4e9f604d8d..6ee9de1e23 100644 --- a/packages/backend/src/server/api/endpoints/notes/mentions.ts +++ b/packages/backend/src/server/api/endpoints/notes/mentions.ts @@ -79,7 +79,7 @@ export default class extends Endpoint { query.setParameters(followingQuery.getParameters()); } - const mentions = await query.take(ps.limit).getMany(); + const mentions = await query.limit(ps.limit).getMany(); this.noteReadService.read(me.id, mentions); diff --git a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts index 6cdc9b902c..0b4ccdcf20 100644 --- a/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/notes/polls/recommendation.ts @@ -82,7 +82,7 @@ export default class extends Endpoint { const polls = await query .orderBy('poll.noteId', 'DESC') - .take(ps.limit) + .limit(ps.limit) .skip(ps.offset) .getMany(); diff --git a/packages/backend/src/server/api/endpoints/notes/renotes.ts b/packages/backend/src/server/api/endpoints/notes/renotes.ts index d406855660..4ee12b3353 100644 --- a/packages/backend/src/server/api/endpoints/notes/renotes.ts +++ b/packages/backend/src/server/api/endpoints/notes/renotes.ts @@ -71,7 +71,7 @@ export default class extends Endpoint { if (me) this.queryService.generateMutedUserQuery(query, me); if (me) this.queryService.generateBlockedUserQuery(query, me); - const renotes = await query.take(ps.limit).getMany(); + const renotes = await query.limit(ps.limit).getMany(); return await this.noteEntityService.packMany(renotes, me); }); diff --git a/packages/backend/src/server/api/endpoints/notes/replies.ts b/packages/backend/src/server/api/endpoints/notes/replies.ts index f2af71d55f..900c40d32a 100644 --- a/packages/backend/src/server/api/endpoints/notes/replies.ts +++ b/packages/backend/src/server/api/endpoints/notes/replies.ts @@ -55,7 +55,7 @@ export default class extends Endpoint { if (me) this.queryService.generateMutedUserQuery(query, me); if (me) this.queryService.generateBlockedUserQuery(query, me); - const timeline = await query.take(ps.limit).getMany(); + const timeline = await query.limit(ps.limit).getMany(); return await this.noteEntityService.packMany(timeline, me); }); diff --git a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts index 742df0ca95..dc0a5dceee 100644 --- a/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts +++ b/packages/backend/src/server/api/endpoints/notes/search-by-tag.ts @@ -130,7 +130,7 @@ export default class extends Endpoint { } // Search notes - const notes = await query.take(ps.limit).getMany(); + const notes = await query.limit(ps.limit).getMany(); return await this.noteEntityService.packMany(notes, me); }); diff --git a/packages/backend/src/server/api/endpoints/notes/timeline.ts b/packages/backend/src/server/api/endpoints/notes/timeline.ts index e1f286439b..7e9bf85d88 100644 --- a/packages/backend/src/server/api/endpoints/notes/timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/timeline.ts @@ -123,7 +123,7 @@ export default class extends Endpoint { } //#endregion - const timeline = await query.take(ps.limit).getMany(); + const timeline = await query.limit(ps.limit).getMany(); process.nextTick(() => { this.activeUsersChart.read(me); diff --git a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts index afc9bc4213..4c19e1a553 100644 --- a/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts +++ b/packages/backend/src/server/api/endpoints/notes/user-list-timeline.ts @@ -127,7 +127,7 @@ export default class extends Endpoint { } //#endregion - const timeline = await query.take(ps.limit).getMany(); + const timeline = await query.limit(ps.limit).getMany(); this.activeUsersChart.read(me); diff --git a/packages/backend/src/server/api/endpoints/pages/featured.ts b/packages/backend/src/server/api/endpoints/pages/featured.ts index 31844165e2..b1c056124e 100644 --- a/packages/backend/src/server/api/endpoints/pages/featured.ts +++ b/packages/backend/src/server/api/endpoints/pages/featured.ts @@ -41,7 +41,7 @@ export default class extends Endpoint { .andWhere('page.likedCount > 0') .orderBy('page.likedCount', 'DESC'); - const pages = await query.take(10).getMany(); + const pages = await query.limit(10).getMany(); return await this.pageEntityService.packMany(pages, me); }); diff --git a/packages/backend/src/server/api/endpoints/renote-mute/list.ts b/packages/backend/src/server/api/endpoints/renote-mute/list.ts index b2d7addb64..cb4e1feba4 100644 --- a/packages/backend/src/server/api/endpoints/renote-mute/list.ts +++ b/packages/backend/src/server/api/endpoints/renote-mute/list.ts @@ -48,7 +48,7 @@ export default class extends Endpoint { .andWhere('muting.muterId = :meId', { meId: me.id }); const mutings = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.renoteMutingEntityService.packMany(mutings, me); diff --git a/packages/backend/src/server/api/endpoints/roles/users.ts b/packages/backend/src/server/api/endpoints/roles/users.ts index b2cb8b42a8..cc27201886 100644 --- a/packages/backend/src/server/api/endpoints/roles/users.ts +++ b/packages/backend/src/server/api/endpoints/roles/users.ts @@ -65,7 +65,7 @@ export default class extends Endpoint { .innerJoinAndSelect('assign.user', 'user'); const assigns = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await Promise.all(assigns.map(async assign => ({ diff --git a/packages/backend/src/server/api/endpoints/users.ts b/packages/backend/src/server/api/endpoints/users.ts index 28cd9f6ce5..2582932e3a 100644 --- a/packages/backend/src/server/api/endpoints/users.ts +++ b/packages/backend/src/server/api/endpoints/users.ts @@ -80,7 +80,7 @@ export default class extends Endpoint { if (me) this.queryService.generateMutedUserQueryForUsers(query, me); if (me) this.queryService.generateBlockQueryForUsers(query, me); - query.take(ps.limit); + query.limit(ps.limit); query.skip(ps.offset); const users = await query.getMany(); diff --git a/packages/backend/src/server/api/endpoints/users/clips.ts b/packages/backend/src/server/api/endpoints/users/clips.ts index c5aa93baaf..c2ad420cb5 100644 --- a/packages/backend/src/server/api/endpoints/users/clips.ts +++ b/packages/backend/src/server/api/endpoints/users/clips.ts @@ -48,7 +48,7 @@ export default class extends Endpoint { .andWhere('clip.isPublic = true'); const clips = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.clipEntityService.packMany(clips, me); diff --git a/packages/backend/src/server/api/endpoints/users/followers.ts b/packages/backend/src/server/api/endpoints/users/followers.ts index 97f1310c36..c6f71474bc 100644 --- a/packages/backend/src/server/api/endpoints/users/followers.ts +++ b/packages/backend/src/server/api/endpoints/users/followers.ts @@ -112,7 +112,7 @@ export default class extends Endpoint { .innerJoinAndSelect('following.follower', 'follower'); const followings = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.followingEntityService.packMany(followings, me, { populateFollower: true }); diff --git a/packages/backend/src/server/api/endpoints/users/following.ts b/packages/backend/src/server/api/endpoints/users/following.ts index d406594a2e..b072c96626 100644 --- a/packages/backend/src/server/api/endpoints/users/following.ts +++ b/packages/backend/src/server/api/endpoints/users/following.ts @@ -112,7 +112,7 @@ export default class extends Endpoint { .innerJoinAndSelect('following.followee', 'followee'); const followings = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.followingEntityService.packMany(followings, me, { populateFollowee: true }); diff --git a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts index 6e57eee5fb..3ee01953d4 100644 --- a/packages/backend/src/server/api/endpoints/users/gallery/posts.ts +++ b/packages/backend/src/server/api/endpoints/users/gallery/posts.ts @@ -47,7 +47,7 @@ export default class extends Endpoint { .andWhere('post.userId = :userId', { userId: ps.userId }); const posts = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.galleryPostEntityService.packMany(posts, me); diff --git a/packages/backend/src/server/api/endpoints/users/notes.ts b/packages/backend/src/server/api/endpoints/users/notes.ts index aaf94734a3..f42f84e6a7 100644 --- a/packages/backend/src/server/api/endpoints/users/notes.ts +++ b/packages/backend/src/server/api/endpoints/users/notes.ts @@ -120,7 +120,7 @@ export default class extends Endpoint { //#endregion - const timeline = await query.take(ps.limit).getMany(); + const timeline = await query.limit(ps.limit).getMany(); return await this.noteEntityService.packMany(timeline, me); }); diff --git a/packages/backend/src/server/api/endpoints/users/pages.ts b/packages/backend/src/server/api/endpoints/users/pages.ts index a105103f16..e9d13ba00f 100644 --- a/packages/backend/src/server/api/endpoints/users/pages.ts +++ b/packages/backend/src/server/api/endpoints/users/pages.ts @@ -48,7 +48,7 @@ export default class extends Endpoint { .andWhere('page.visibility = \'public\''); const pages = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await this.pageEntityService.packMany(pages); diff --git a/packages/backend/src/server/api/endpoints/users/reactions.ts b/packages/backend/src/server/api/endpoints/users/reactions.ts index ac401a60ee..37fc854c33 100644 --- a/packages/backend/src/server/api/endpoints/users/reactions.ts +++ b/packages/backend/src/server/api/endpoints/users/reactions.ts @@ -73,7 +73,7 @@ export default class extends Endpoint { this.queryService.generateVisibilityQuery(query, me); const reactions = await query - .take(ps.limit) + .limit(ps.limit) .getMany(); return await Promise.all(reactions.map(reaction => this.noteReactionEntityService.pack(reaction, me, { withNote: true }))); diff --git a/packages/backend/src/server/api/endpoints/users/recommendation.ts b/packages/backend/src/server/api/endpoints/users/recommendation.ts index 6fcc04e2c5..d39657059a 100644 --- a/packages/backend/src/server/api/endpoints/users/recommendation.ts +++ b/packages/backend/src/server/api/endpoints/users/recommendation.ts @@ -70,7 +70,7 @@ export default class extends Endpoint { query.setParameters(followingQuery.getParameters()); - const users = await query.take(ps.limit).skip(ps.offset).getMany(); + const users = await query.limit(ps.limit).skip(ps.offset).getMany(); return await this.userEntityService.packMany(users, me, { detail: true }); }); diff --git a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts index b001159ee8..1d0c7d0c1d 100644 --- a/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts +++ b/packages/backend/src/server/api/endpoints/users/search-by-username-and-host.ts @@ -97,7 +97,7 @@ export default class extends Endpoint { users = await query .orderBy('user.usernameLower', 'ASC') - .take(ps.limit) + .limit(ps.limit) .getMany(); if (users.length < ps.limit) { @@ -110,7 +110,7 @@ export default class extends Endpoint { const otherUsers = await otherQuery .orderBy('user.updatedAt', 'DESC') - .take(ps.limit - users.length) + .limit(ps.limit - users.length) .getMany(); users = users.concat(otherUsers); @@ -122,7 +122,7 @@ export default class extends Endpoint { users = await query .orderBy('user.updatedAt', 'DESC') - .take(ps.limit - users.length) + .limit(ps.limit - users.length) .getMany(); } diff --git a/packages/backend/src/server/api/endpoints/users/search.ts b/packages/backend/src/server/api/endpoints/users/search.ts index 5ffe3e84aa..177441bc78 100644 --- a/packages/backend/src/server/api/endpoints/users/search.ts +++ b/packages/backend/src/server/api/endpoints/users/search.ts @@ -73,7 +73,7 @@ export default class extends Endpoint { users = await usernameQuery .orderBy('user.updatedAt', 'DESC', 'NULLS LAST') - .take(ps.limit) + .limit(ps.limit) .skip(ps.offset) .getMany(); } else { @@ -100,7 +100,7 @@ export default class extends Endpoint { users = await nameQuery .orderBy('user.updatedAt', 'DESC', 'NULLS LAST') - .take(ps.limit) + .limit(ps.limit) .skip(ps.offset) .getMany(); @@ -126,7 +126,7 @@ export default class extends Endpoint { users = users.concat(await query .orderBy('user.updatedAt', 'DESC', 'NULLS LAST') - .take(ps.limit) + .limit(ps.limit) .skip(ps.offset) .getMany(), );