Skip to content

Commit

Permalink
Merge pull request #66 from Team-Shaka/feat/63
Browse files Browse the repository at this point in the history
🐛 Bug: InvitationMapper static 설정
  • Loading branch information
HyoBN authored Jun 24, 2024
2 parents 1342337 + 1e83c2a commit 380c27c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class InvitationMapper {

public InvitationResponseDTO.getInvitation toGetInvitation (Invitation invitation, List<String> treeMemberProfileImages) {
public static InvitationResponseDTO.getInvitation toGetInvitation (Invitation invitation, List<String> treeMemberProfileImages) {
return InvitationResponseDTO.getInvitation.builder()
.invitationId(invitation.getId())
.treehouseName(invitation.getTreeHouse().getName())
Expand All @@ -30,26 +30,26 @@ public InvitationResponseDTO.getInvitation toGetInvitation (Invitation invitatio
.treehouseMemberProfileImages(treeMemberProfileImages)
.build();
}
public InvitationResponseDTO.getInvitations toGetInvitations(List<InvitationResponseDTO.getInvitation> invitationDtos) {
public static InvitationResponseDTO.getInvitations toGetInvitations(List<InvitationResponseDTO.getInvitation> 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();
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class InvitationService {
private final InvitationQueryAdapter invitationQueryAdapter;

private final InvitationCommandAdapter invitationCommandAdapter;
private final InvitationMapper invitationMapper;

private final TreehouseQueryAdapter treehouseQueryAdapter;

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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);
}
}

0 comments on commit 380c27c

Please sign in to comment.