From 575d694f78d5be5f0198d6af48e7f9e21711cf5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=ED=98=84=EC=9A=B0?= <83938394+yunuo46@users.noreply.github.com> Date: Mon, 11 Dec 2023 12:38:17 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=8A=A4=EB=85=B8=EC=9A=B0=EB=B3=BC=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=EB=94=94=EB=A1=9C=20=EC=9C=A0=EC=A0=80=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=ED=95=98=EC=97=AC=20=EB=A9=94=EC=84=B8?= =?UTF-8?q?=EC=A7=80=20=EC=B9=B4=EC=9A=B4=ED=8A=B8=20=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/src/modules/snowball/snowball.controller.ts | 1 - back/src/modules/snowball/snowball.service.ts | 12 +++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/back/src/modules/snowball/snowball.controller.ts b/back/src/modules/snowball/snowball.controller.ts index 4d18728..3f13fe3 100644 --- a/back/src/modules/snowball/snowball.controller.ts +++ b/back/src/modules/snowball/snowball.controller.ts @@ -104,7 +104,6 @@ export class SnowballController { @Param('snowball_id') snowball_id: number ) { const resGetSnowballDto = await this.snowballService.getResGetSnowballDto( - req.user.id, snowball_id, req.hasToken ); diff --git a/back/src/modules/snowball/snowball.service.ts b/back/src/modules/snowball/snowball.service.ts index 3197ff5..ad75eed 100644 --- a/back/src/modules/snowball/snowball.service.ts +++ b/back/src/modules/snowball/snowball.service.ts @@ -137,12 +137,12 @@ export class SnowballService { } async getResGetSnowballDto( - user_id: number, snowball_id: number, hasToken: boolean ): Promise { const snowball = await this.getSnowball(snowball_id, hasToken); if (!snowball) throw new NotFoundException('스노우볼을 찾을 수 없습니다.'); + const user_id = await this.getUserId(snowball_id); const resGetSnowball = { message_count: await this.messageService.getMessageCount(user_id), snowball @@ -150,6 +150,16 @@ export class SnowballService { return plainToInstance(ResGetSnowballDto, resGetSnowball); } + async getUserId(snowball_id: number): Promise { + const user = await this.snowballRepository.findOne({ + where: { id: snowball_id }, + select: ['user_id'] + }); + if (!user) + throw new NotFoundException('스노우볼을 소유한 유저를 찾을 수 없습니다.'); + return user.id; + } + async doesDecorationExist(decoration_id: number): Promise { const decoration = await this.snowballDecoRepository.findOne({ where: { id: decoration_id, active: true }