diff --git a/src/main/java/com/hanaro/triptogether/teamMember/controller/TeamMemberContoller.java b/src/main/java/com/hanaro/triptogether/teamMember/controller/TeamMemberContoller.java index 0fda3e9..87ecb2f 100644 --- a/src/main/java/com/hanaro/triptogether/teamMember/controller/TeamMemberContoller.java +++ b/src/main/java/com/hanaro/triptogether/teamMember/controller/TeamMemberContoller.java @@ -48,7 +48,7 @@ public void acceptTeamMembers(@RequestBody AcceptTeamMembersReqDto acceptTeamMem // 모임원 거절 (수락대기-> 모임원 삭제) @PutMapping("/team/reject-one") - public void rejectTeamMember(@RequestBody AcceptTeamMemberReqDto acceptTeamMemberReqDto) { + public void rejectTeamMember(@RequestBody AcceptTeamMemberReqDto acceptTeamMemberReqDto) throws IOException { teamMemberService.rejectTeamMember(acceptTeamMemberReqDto); } @@ -60,7 +60,7 @@ public void rejectTeamMembers(@RequestBody RejectTeamMembersReqDto rejectTeamMem // 모임원 내보내기 (모임원-> 모임원 삭제) @PutMapping("/team/export-member") - public void exportTeamMember(@RequestBody AcceptTeamMemberReqDto acceptTeamMemberReqDto) { + public void exportTeamMember(@RequestBody AcceptTeamMemberReqDto acceptTeamMemberReqDto) throws IOException { teamMemberService.rejectTeamMember(acceptTeamMemberReqDto); } diff --git a/src/main/java/com/hanaro/triptogether/teamMember/service/TeamMemberService.java b/src/main/java/com/hanaro/triptogether/teamMember/service/TeamMemberService.java index 15c65f4..766bbb9 100644 --- a/src/main/java/com/hanaro/triptogether/teamMember/service/TeamMemberService.java +++ b/src/main/java/com/hanaro/triptogether/teamMember/service/TeamMemberService.java @@ -24,7 +24,7 @@ public interface TeamMemberService { // 모임원 거절 (수락대기-> 모임원 삭제) // 모임원 내보내기 (모임원-> 모임원 삭제) - void rejectTeamMember(AcceptTeamMemberReqDto acceptTeamMemberReqDto); + void rejectTeamMember(AcceptTeamMemberReqDto acceptTeamMemberReqDto) throws IOException; // 모임원 전체 거절 (수락대기-> 모임원 삭제) void rejectTeamMembers(RejectTeamMembersReqDto rejectTeamMembersReqDto); diff --git a/src/main/java/com/hanaro/triptogether/teamMember/service/impl/TeamMemberServiceImpl.java b/src/main/java/com/hanaro/triptogether/teamMember/service/impl/TeamMemberServiceImpl.java index 7fe3b8a..cf4a778 100644 --- a/src/main/java/com/hanaro/triptogether/teamMember/service/impl/TeamMemberServiceImpl.java +++ b/src/main/java/com/hanaro/triptogether/teamMember/service/impl/TeamMemberServiceImpl.java @@ -88,7 +88,7 @@ public void changeOwner(ChangeOwnerReqDto changeOwnerReqDto) { public void acceptTeamMember(AcceptTeamMemberReqDto acceptTeamMemberReqDto) throws IOException { Team team = teamRepository.findById(acceptTeamMemberReqDto.getTeamIdx()).orElseThrow(() -> new ApiException(ExceptionEnum.TEAM_NOT_FOUND)); List teamMembers = teamMemberRepository.findTeamMembersByTeam(team); - Member member = memberRepository.findById(acceptTeamMemberReqDto.getMemberIdx()).orElseThrow(EntityNotFoundException::new); + Member member = memberRepository.findById(acceptTeamMemberReqDto.getTeamMemberIdx()).orElseThrow(EntityNotFoundException::new); for(int i = 0; i < teamMembers.size(); i++) { if (acceptTeamMemberReqDto.getTeamMemberIdx().equals(teamMembers.get(i).getTeamMemberIdx())) { teamMembers.get(i).updateTeamMemberState(TeamMemberState.모임원); @@ -120,10 +120,10 @@ public void acceptTeamMembers(AcceptTeamMembersReqDto acceptTeamMembersReqDto) { // 모임원 내보내기 (모임원-> 모임원 삭제) @Transactional @Override - public void rejectTeamMember(AcceptTeamMemberReqDto acceptTeamMemberReqDto) { + public void rejectTeamMember(AcceptTeamMemberReqDto acceptTeamMemberReqDto) throws IOException { Team team = teamRepository.findById(acceptTeamMemberReqDto.getTeamIdx()).orElseThrow(() -> new ApiException(ExceptionEnum.TEAM_NOT_FOUND)); List teamMembers = teamMemberRepository.findTeamMembersByTeam(team); - + Member member = memberRepository.findById(acceptTeamMemberReqDto.getTeamMemberIdx()).orElseThrow(EntityNotFoundException::new); for(int i = 0; i < teamMembers.size(); i++) { if (acceptTeamMemberReqDto.getTeamMemberIdx().equals(teamMembers.get(i).getTeamMemberIdx())) { teamMembers.get(i).updateTeamMemberState(TeamMemberState.거절); @@ -131,6 +131,9 @@ public void rejectTeamMember(AcceptTeamMemberReqDto acceptTeamMemberReqDto) { teamMemberRepository.save(teamMembers.get(i)); } } + + firebaseFCMService.sendMessageTo(FcmSendDto.builder().token(member.getFcmToken()).title("모임 참여 거절").body(team.getTeamName()+"모임가입에 거절되었습니다.").build()); + } // 모임원 전체 거절 (수락대기-> 모임원 삭제)