From 55dc0042433d38476dc8efed2d0b472de6a4c899 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EA=B7=BC=ED=98=95?= Date: Sat, 25 May 2024 11:26:28 +0900 Subject: [PATCH] feat: getEvent --- src/group/group.controller.ts | 4 ++-- src/group/group.service.ts | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/group/group.controller.ts b/src/group/group.controller.ts index bc2b86b..92e804b 100644 --- a/src/group/group.controller.ts +++ b/src/group/group.controller.ts @@ -184,8 +184,8 @@ export class GroupController { summary: '모임 이벤트 상세 조회', description: '특정 모임의 특정 이벤트를 조회합니다.', }) - getEvent(@Param('groupId') groupId: string, @Param('eventId') eventId: string) { - return this.groupService.getEvents(groupId, eventId); + getEvent(@Req() req: any, @Param('groupId') groupId: string, @Param('eventId') eventId: string) { + return this.groupService.getEvent(req.userId, groupId, eventId); } @Get(':groupId/transaction') diff --git a/src/group/group.service.ts b/src/group/group.service.ts index 813f108..4a61e51 100644 --- a/src/group/group.service.ts +++ b/src/group/group.service.ts @@ -151,6 +151,13 @@ export class GroupService { return await this.getAllEvents(group.events); } + async getEvent(userId: string, groupId: string, eventId: string) { + const group = await this.groupRepository.findOne(groupId); + this.groupValidator.validateGroupViewer(group, userId); + + return this.eventService.getOne(eventId); + } + async getTransactions(userId: string, groupId: string) { const group = await this.groupRepository.findOne(groupId); this.groupValidator.validateGroupViewer(group, userId);