diff --git a/umbba-api/src/main/java/sopt/org/umbba/api/controller/qna/dto/response/MyUserInfoResponseDto.java b/umbba-api/src/main/java/sopt/org/umbba/api/controller/qna/dto/response/MyUserInfoResponseDto.java index a1b7fc6..ac6bc0a 100644 --- a/umbba-api/src/main/java/sopt/org/umbba/api/controller/qna/dto/response/MyUserInfoResponseDto.java +++ b/umbba-api/src/main/java/sopt/org/umbba/api/controller/qna/dto/response/MyUserInfoResponseDto.java @@ -32,6 +32,8 @@ public class MyUserInfoResponseDto { private String inviteCode; private String installUrl; + private Boolean isOpponentExit; + public static MyUserInfoResponseDto of(User myUser, User opponentUser, Parentchild parentchild, QnA qnA, long date, int qnaCnt) { return MyUserInfoResponseDto.builder() @@ -43,7 +45,9 @@ public static MyUserInfoResponseDto of(User myUser, User opponentUser, Parentchi .isMeChild(myUser.isMeChild()) .section(qnA.getQuestion().getSection().getValue()) .matchedDate(date) // 일수와 문답 수는 다를 수 있음 - .qnaCnt(qnaCnt).build(); + .qnaCnt(qnaCnt) + .isOpponentExit(false) + .build(); } // 아직 매칭된 유저가 없는 경우 @@ -60,6 +64,25 @@ public static MyUserInfoResponseDto of(User myUser, Parentchild parentchild) { .qnaCnt(0) .inviteCode(parentchild.getInviteCode()) .installUrl("http://umbba.site/") + .isOpponentExit(false) + .build(); + } + + // 상대방이 탈퇴했을 경우 + public static MyUserInfoResponseDto of(User myUser, Parentchild parentchild, boolean isOpponentExit) { + + return MyUserInfoResponseDto.builder() + .myUsername(myUser.getUsername()) + .myUserType(getUserType(parentchild.getRelation(), myUser.isMeChild())) + .opponentUserType(getUserType(parentchild.getRelation(), !myUser.isMeChild())) + .parentchildRelation(parentchild.getRelation().getValue()) + .isMeChild(myUser.isMeChild()) + .section(QuestionSection.YOUNG.getValue()) + .matchedDate(0L) + .qnaCnt(0) + .inviteCode(parentchild.getInviteCode()) + .installUrl("http://umbba.site/") + .isOpponentExit(isOpponentExit) .build(); } } diff --git a/umbba-api/src/main/java/sopt/org/umbba/api/service/qna/QnAService.java b/umbba-api/src/main/java/sopt/org/umbba/api/service/qna/QnAService.java index 9f53828..dc8f3c6 100644 --- a/umbba-api/src/main/java/sopt/org/umbba/api/service/qna/QnAService.java +++ b/umbba-api/src/main/java/sopt/org/umbba/api/service/qna/QnAService.java @@ -41,6 +41,7 @@ import static sopt.org.umbba.domain.domain.qna.OnboardingAnswer.YES; import static sopt.org.umbba.domain.domain.qna.QuestionSection.*; import static sopt.org.umbba.domain.domain.qna.QuestionType.*; +import static sopt.org.umbba.domain.domain.user.SocialPlatform.*; @Slf4j @@ -93,7 +94,7 @@ else if (matchUser.isEmpty()) { else if (matchUser.get().getUsername() == null) { return invitation(userId); } - else if (matchUser.get().getSocialPlatform().equals(SocialPlatform.WITHDRAW)) { + else if (matchUser.get().getSocialPlatform().equals(WITHDRAW)) { return withdrawUser(); } @@ -280,6 +281,11 @@ public MyUserInfoResponseDto getUserInfo(final Long userId) { } User opponentUser = getOpponentByParentchild(parentchild, userId); + // 상대 유저가 탈퇴했을 경우 + if (opponentUser.getSocialPlatform().equals(WITHDRAW)) { + return MyUserInfoResponseDto.of(myUser, parentchild, true); + } + QnA todayQnA = getTodayQnAByParentchild(parentchild); int qnaCnt = parentchild.getCount();