From a90e19779755bd058e8c7d850001fd6b10cba70d Mon Sep 17 00:00:00 2001 From: koojun99 Date: Thu, 10 Oct 2024 20:13:57 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix:=20=EC=88=98=EB=9D=BD?= =?UTF-8?q?=ED=95=9C=20=EC=B4=88=EB=8C=80=EC=9E=A5=EB=8F=84=20=EC=B6=9C?= =?UTF-8?q?=EB=A0=A5=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=20+?= =?UTF-8?q?=20=ED=86=A0=ED=81=B0=20=EC=8B=9C=EA=B0=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/invitation/business/InvitationService.java | 11 ++++++++++- .../implement/InvitationCommandAdapter.java | 1 + .../api/invitation/presentation/InvitationApi.java | 9 +++++++++ src/main/resources/application.yml | 4 ++-- 4 files changed, 22 insertions(+), 3 deletions(-) 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}