diff --git a/src/main/java/treehouse/server/api/invitation/business/InvitationService.java b/src/main/java/treehouse/server/api/invitation/business/InvitationService.java index c003110..ecf2990 100644 --- a/src/main/java/treehouse/server/api/invitation/business/InvitationService.java +++ b/src/main/java/treehouse/server/api/invitation/business/InvitationService.java @@ -48,7 +48,7 @@ public class InvitationService { @Transactional public InvitationResponseDTO.getInvitations getInvitations(User user) { - List invitations = invitationQueryAdapter.findAllPendingByPhone(user.getPhone()); + List invitations = invitationQueryAdapter.findAllByPhone(user.getPhone()); List invitationDtos = invitations.stream() .map(invitation -> { @@ -117,7 +117,16 @@ public InvitationResponseDTO.invitationAccept decisionInvitation(User user, Invi treehouseId = invitation.getTreeHouse().getId(); // treehouse 관련 로직 개발 후, invitation.getTreeHouse.getId() 등으로 바꾸기 // 초대장 수락 invitationCommandAdapter.acceptInvitation(invitation); + } else if (request.isAcceptDecision()==false) { + // 초대장 거절 + invitationCommandAdapter.deleteInvitation(invitation); } return InvitationMapper.toInvitationResult(treehouseId); } + + @Transactional + public void deleteInvitation(Long invitationId) { + Invitation invitation = invitationQueryAdapter.findById(invitationId); + invitationCommandAdapter.deleteInvitation(invitation); + } } diff --git a/src/main/java/treehouse/server/api/invitation/implement/InvitationCommandAdapter.java b/src/main/java/treehouse/server/api/invitation/implement/InvitationCommandAdapter.java index 8f75e93..a3e8990 100644 --- a/src/main/java/treehouse/server/api/invitation/implement/InvitationCommandAdapter.java +++ b/src/main/java/treehouse/server/api/invitation/implement/InvitationCommandAdapter.java @@ -36,4 +36,5 @@ public void acceptInvitation(Invitation invitation) { invitation.setStatus(InvitationStatus.ACCEPTED); invitationRepository.save(invitation); } + } diff --git a/src/main/java/treehouse/server/api/invitation/presentation/InvitationApi.java b/src/main/java/treehouse/server/api/invitation/presentation/InvitationApi.java index 7147361..ac5dcfb 100644 --- a/src/main/java/treehouse/server/api/invitation/presentation/InvitationApi.java +++ b/src/main/java/treehouse/server/api/invitation/presentation/InvitationApi.java @@ -53,4 +53,13 @@ public CommonResponse createInvitation( ){ return CommonResponse.onSuccess(invitationService.createInvitation(user,request)); } + + @DeleteMapping("/invitation/{invitationId}") + @Operation(summary = "초대장 삭제 API ✅ 🔑", description = "초대장을 삭제하는 API 입니다.") + public CommonResponse deleteInvitation( + @PathVariable Long invitationId + ){ + invitationService.deleteInvitation(invitationId); + return CommonResponse.onSuccess(null); + } } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index caa2534..faf3ce5 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -143,8 +143,8 @@ jwt: key: ${JWT_SECRET} # secret : ${JWT_SECRET} authorities-key: authoritiesKey - access-token-validity-in-seconds: 7200000 # 2 hour - refresh-token-validity-in-seconds: 2592000000 # 30 day + access-token-validity-in-seconds: 120000 # 2 min + refresh-token-validity-in-seconds: 300000 # 30 day firebase: admin-sdk: ${FCM_KEY}