From 477b0e6cc0e9ecba08ff0ddb32c9643ab5d1613e Mon Sep 17 00:00:00 2001 From: ddongseop Date: Tue, 30 Apr 2024 11:06:06 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[FIX]=20=EC=83=81=EB=8C=80=20=EC=9C=A0?= =?UTF-8?q?=EC=A0=80=20=ED=83=88=ED=87=B4=EB=A5=BC=20=EC=95=8C=EB=A0=A4?= =?UTF-8?q?=EC=A3=BC=EB=8A=94=20=ED=95=84=EB=93=9C=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?#148?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/MyUserInfoResponseDto.java | 22 +++++++++++++++++++ .../org/umbba/api/service/qna/QnAService.java | 8 ++++++- 2 files changed, 29 insertions(+), 1 deletion(-) 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 a1b7fc6d..beddeff6 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,6 +45,7 @@ public static MyUserInfoResponseDto of(User myUser, User opponentUser, Parentchi .isMeChild(myUser.isMeChild()) .section(qnA.getQuestion().getSection().getValue()) .matchedDate(date) // 일수와 문답 수는 다를 수 있음 + .isOpponentExit(false) .qnaCnt(qnaCnt).build(); } @@ -60,6 +63,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 9f53828e..dc8f3c6c 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(); From d56651cb8aff3b1f452bc17d400d732cc8142092 Mon Sep 17 00:00:00 2001 From: ddongseop Date: Tue, 30 Apr 2024 11:11:11 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[FIX]=20=EB=B9=8C=EB=8D=94=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=20=EC=88=9C=EC=84=9C=20=EC=A0=95=EB=A6=AC=20?= =?UTF-8?q?#148?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/controller/qna/dto/response/MyUserInfoResponseDto.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 beddeff6..ac6bc0a2 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 @@ -45,8 +45,9 @@ public static MyUserInfoResponseDto of(User myUser, User opponentUser, Parentchi .isMeChild(myUser.isMeChild()) .section(qnA.getQuestion().getSection().getValue()) .matchedDate(date) // 일수와 문답 수는 다를 수 있음 + .qnaCnt(qnaCnt) .isOpponentExit(false) - .qnaCnt(qnaCnt).build(); + .build(); } // 아직 매칭된 유저가 없는 경우