From 1e83c2a9d17ab3fcd364327efc7f8f6566d201f3 Mon Sep 17 00:00:00 2001 From: HyoBN Date: Mon, 24 Jun 2024 16:58:06 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Bug:=20InvitationMapper=20static?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/invitation/business/InvitationMapper.java | 12 ++++++------ .../api/invitation/business/InvitationService.java | 13 ++++++------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main/java/treehouse/server/api/invitation/business/InvitationMapper.java b/src/main/java/treehouse/server/api/invitation/business/InvitationMapper.java index 28b7382..970222a 100644 --- a/src/main/java/treehouse/server/api/invitation/business/InvitationMapper.java +++ b/src/main/java/treehouse/server/api/invitation/business/InvitationMapper.java @@ -20,7 +20,7 @@ @NoArgsConstructor(access = AccessLevel.PRIVATE) public class InvitationMapper { - public InvitationResponseDTO.getInvitation toGetInvitation (Invitation invitation, List treeMemberProfileImages) { + public static InvitationResponseDTO.getInvitation toGetInvitation (Invitation invitation, List treeMemberProfileImages) { return InvitationResponseDTO.getInvitation.builder() .invitationId(invitation.getId()) .treehouseName(invitation.getTreeHouse().getName()) @@ -30,26 +30,26 @@ public InvitationResponseDTO.getInvitation toGetInvitation (Invitation invitatio .treehouseMemberProfileImages(treeMemberProfileImages) .build(); } - public InvitationResponseDTO.getInvitations toGetInvitations(List invitationDtos) { + public static InvitationResponseDTO.getInvitations toGetInvitations(List invitationDtos) { return InvitationResponseDTO.getInvitations.builder() .invitations(invitationDtos) .build(); } - public InvitationResponseDTO.myInvitationInfo toMyInvitationInfo(User user){ + public static InvitationResponseDTO.myInvitationInfo toMyInvitationInfo(User user){ return InvitationResponseDTO.myInvitationInfo.builder() .availableInvitation(user.getInvitationCount()) .activeRate(user.getActiveRate()) .build(); } - public InvitationResponseDTO.invitationAccept toInvitationResult(Long treeHouseId){ + public static InvitationResponseDTO.invitationAccept toInvitationResult(Long treeHouseId){ return InvitationResponseDTO.invitationAccept.builder() .treehouseId(treeHouseId) .build(); } - public Invitation toInvitation(String phoneNumber, Member sender, User receiver, TreeHouse treeHouse){ + public static Invitation toInvitation(String phoneNumber, Member sender, User receiver, TreeHouse treeHouse){ LocalDateTime now = LocalDateTime.now(); @@ -66,7 +66,7 @@ public Invitation toInvitation(String phoneNumber, Member sender, User receiver, .build(); } - public InvitationResponseDTO.createInvitation toCreateInvitationDTO (Invitation invitation){ + public static InvitationResponseDTO.createInvitation toCreateInvitationDTO (Invitation invitation){ return InvitationResponseDTO.createInvitation.builder() .invitationId(invitation.getId()) .build(); 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 2ba17e3..57f80c2 100644 --- a/src/main/java/treehouse/server/api/invitation/business/InvitationService.java +++ b/src/main/java/treehouse/server/api/invitation/business/InvitationService.java @@ -29,7 +29,6 @@ public class InvitationService { private final InvitationQueryAdapter invitationQueryAdapter; private final InvitationCommandAdapter invitationCommandAdapter; - private final InvitationMapper invitationMapper; private final TreehouseQueryAdapter treehouseQueryAdapter; @@ -53,14 +52,14 @@ public InvitationResponseDTO.getInvitations getInvitations(User user) { .map(Member::getProfileImageUrl) .limit(treeMemberRandomProfileSize) .toList(); - return invitationMapper.toGetInvitation(invitation, randomProfileImages); + return InvitationMapper.toGetInvitation(invitation, randomProfileImages); }) .collect(Collectors.toList()); - return invitationMapper.toGetInvitations(invitationDtos); + return InvitationMapper.toGetInvitations(invitationDtos); } public InvitationResponseDTO.myInvitationInfo getMyInvitationInfo(User user){ - return invitationMapper.toMyInvitationInfo(user); + return InvitationMapper.toMyInvitationInfo(user); } @Transactional @@ -82,11 +81,11 @@ public InvitationResponseDTO.createInvitation createInvitation(User user, Invita } // 초대장 만들어서 저장하기 - Invitation invitation = invitationCommandAdapter.saveInvitation(invitationMapper.toInvitation(request.getPhoneNumber(), sender, receiverUser, treehouse)); + Invitation invitation = invitationCommandAdapter.saveInvitation(InvitationMapper.toInvitation(request.getPhoneNumber(), sender, receiverUser, treehouse)); // 리턴하기 - return invitationMapper.toCreateInvitationDTO(invitation); + return InvitationMapper.toCreateInvitationDTO(invitation); } @Transactional @@ -96,6 +95,6 @@ public InvitationResponseDTO.invitationAccept decisionInvitation(User user, Invi if (request.isAcceptDecision()==true) { treehouseId = 1L; // treehouse 관련 로직 개발 후, invitation.getTreeHouse.getId() 등으로 바꾸기 } - return invitationMapper.toInvitationResult(treehouseId); + return InvitationMapper.toInvitationResult(treehouseId); } }