diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-07-08 16:53:07 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2023-07-08 16:53:07 +0900 |
| commit | 081a14d6f3ca3664aabdd06aaf06080dcba17c25 (patch) | |
| tree | 901a7a55b38b83be49ace77c8d9f1d27a85054c8 /packages/backend/src/server/api/endpoints/gallery | |
| parent | use node 20.3.1 (diff) | |
| download | sharkey-081a14d6f3ca3664aabdd06aaf06080dcba17c25.tar.gz sharkey-081a14d6f3ca3664aabdd06aaf06080dcba17c25.tar.bz2 sharkey-081a14d6f3ca3664aabdd06aaf06080dcba17c25.zip | |
perf(backend): use limit() instead of take()
Diffstat (limited to 'packages/backend/src/server/api/endpoints/gallery')
3 files changed, 3 insertions, 3 deletions
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<typeof meta, typeof paramDef> { .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<typeof meta, typeof paramDef> { .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<typeof meta, typeof paramDef> { 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); }); |