From 6b2aeee0e9a4a05687a15c0c6ef700dcd519ffcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=80=E1=85=AA=E1=86=BC=E1=84=92?= =?UTF-8?q?=E1=85=AE=E1=86=AB?= Date: Wed, 29 May 2024 00:24:08 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Feat=20:=20rank=20type=20=EA=B3=A0=EC=B9=98?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stat/rank.controller.ts | 4 +++- src/utils/stat.repository.ts | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/stat/rank.controller.ts b/src/stat/rank.controller.ts index 61d053d..cf336b5 100644 --- a/src/stat/rank.controller.ts +++ b/src/stat/rank.controller.ts @@ -124,7 +124,9 @@ export class RankController { description: '서버 오류', }) async findTotalRank(@Query() options: RankListOptionDto) { - return await this.totalService.getTotalRank(options); + const a = await this.totalService.getTotalRank(options); + console.log(a); + return a; } @ApiTags('rank') diff --git a/src/utils/stat.repository.ts b/src/utils/stat.repository.ts index 935fa75..554b2ee 100644 --- a/src/utils/stat.repository.ts +++ b/src/utils/stat.repository.ts @@ -32,7 +32,14 @@ export class StatRepository extends Repository { .orderBy('point', 'DESC') .addOrderBy('userId') .limit(3); - return await (>queryBuilder.getRawMany()); + const result = await (>( + queryBuilder.getRawMany() + )); + result.forEach( + (result) => (result.rank = parseInt(String(result.rank), 10)), + ); + + return result; } public async findIndividualRank(userId: string, options: PointFindDto) { From dcb6da9aee3315e19a41ff023ce187f47bf4c1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=8B=E1=85=B5=E1=84=80=E1=85=AA=E1=86=BC=E1=84=92?= =?UTF-8?q?=E1=85=AE=E1=86=AB?= Date: Wed, 29 May 2024 00:29:00 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Fix=20:=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stat/rank.controller.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/stat/rank.controller.ts b/src/stat/rank.controller.ts index cf336b5..61d053d 100644 --- a/src/stat/rank.controller.ts +++ b/src/stat/rank.controller.ts @@ -124,9 +124,7 @@ export class RankController { description: '서버 오류', }) async findTotalRank(@Query() options: RankListOptionDto) { - const a = await this.totalService.getTotalRank(options); - console.log(a); - return a; + return await this.totalService.getTotalRank(options); } @ApiTags('rank')