diff --git a/src/main/java/com/tukorea/planding/domain/group/controller/GroupInviteController.java b/src/main/java/com/tukorea/planding/domain/group/controller/GroupInviteController.java index b520f0b..2eaa20e 100644 --- a/src/main/java/com/tukorea/planding/domain/group/controller/GroupInviteController.java +++ b/src/main/java/com/tukorea/planding/domain/group/controller/GroupInviteController.java @@ -3,6 +3,7 @@ import com.tukorea.planding.common.CommonResponse; import com.tukorea.planding.common.CommonUtils; import com.tukorea.planding.domain.group.dto.request.GroupInviteRequest; +import com.tukorea.planding.domain.group.dto.response.GroupInviteAcceptResponse; import com.tukorea.planding.domain.group.service.GroupInviteService; import com.tukorea.planding.domain.group.dto.response.GroupInviteMessageResponse; import com.tukorea.planding.domain.user.dto.UserInfo; @@ -29,9 +30,9 @@ public CommonResponse invite(@AuthenticationPrincipa @Operation(summary = "초대를 수락한다") @GetMapping("/accept/{groupId}/{code}") - public CommonResponse accept(@AuthenticationPrincipal UserInfo userInfo, @PathVariable(name = "groupId") Long groupId, @PathVariable(name = "code") String code) { - groupInviteService.acceptInvitation(userInfo, code, groupId); - return CommonUtils.success("수락완료"); + public CommonResponse accept(@AuthenticationPrincipal UserInfo userInfo, @PathVariable(name = "groupId") Long groupId, @PathVariable(name = "code") String code) { + GroupInviteAcceptResponse response = groupInviteService.acceptInvitation(userInfo, code, groupId); + return CommonUtils.success(response); } @Operation(summary = "초대를 받은 목록", description = "아직 초대의 상태를 바꾸지 않은 경우만") diff --git a/src/main/java/com/tukorea/planding/domain/group/dto/response/GroupInviteAcceptResponse.java b/src/main/java/com/tukorea/planding/domain/group/dto/response/GroupInviteAcceptResponse.java new file mode 100644 index 0000000..cde232e --- /dev/null +++ b/src/main/java/com/tukorea/planding/domain/group/dto/response/GroupInviteAcceptResponse.java @@ -0,0 +1,9 @@ +package com.tukorea.planding.domain.group.dto.response; + +import lombok.Builder; + +@Builder +public record GroupInviteAcceptResponse( + Long groupId +) { +} diff --git a/src/main/java/com/tukorea/planding/domain/group/service/GroupInviteService.java b/src/main/java/com/tukorea/planding/domain/group/service/GroupInviteService.java index 258296b..85adce0 100644 --- a/src/main/java/com/tukorea/planding/domain/group/service/GroupInviteService.java +++ b/src/main/java/com/tukorea/planding/domain/group/service/GroupInviteService.java @@ -2,6 +2,7 @@ import com.tukorea.planding.domain.group.dto.GroupInviteEvent; import com.tukorea.planding.domain.group.dto.request.GroupInviteRequest; +import com.tukorea.planding.domain.group.dto.response.GroupInviteAcceptResponse; import com.tukorea.planding.domain.group.dto.response.GroupInviteMessageResponse; import com.tukorea.planding.domain.group.entity.GroupRoom; import com.tukorea.planding.domain.group.entity.UserGroup; @@ -60,7 +61,7 @@ public GroupInviteMessageResponse inviteGroupRoom(UserInfo userInfo, GroupInvite } @Transactional - public void acceptInvitation(UserInfo userInfo, String code, Long groupId) { + public GroupInviteAcceptResponse acceptInvitation(UserInfo userInfo, String code, Long groupId) { User user = userQueryService.getUserByUserCode(userInfo.getUserCode()); GroupRoom group = groupQueryService.getGroupById(groupId); @@ -68,6 +69,8 @@ public void acceptInvitation(UserInfo userInfo, String code, Long groupId) { userGroupQueryService.save(userGroup); redisGroupInviteService.deleteInvitation(userInfo.getUserCode(), code); + + return GroupInviteAcceptResponse.builder().groupId(groupId).build(); } public List getInvitations(UserInfo userInfo) { diff --git a/src/main/java/com/tukorea/planding/domain/notify/service/NotificationService.java b/src/main/java/com/tukorea/planding/domain/notify/service/NotificationService.java index 581a18d..9ec2061 100644 --- a/src/main/java/com/tukorea/planding/domain/notify/service/NotificationService.java +++ b/src/main/java/com/tukorea/planding/domain/notify/service/NotificationService.java @@ -42,10 +42,6 @@ public void notifyInvitation(final String userCode, final String groupName) { eventPublisher.publishEvent(event); } - public void notifyGroupSchedule(final String userCode, final String schedule) { - - } - @EventListener public void handleGroupInvitedEvent(GroupInviteEvent event) { NotificationScheduleRequest request = NotificationScheduleRequest.builder()