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 ac6bc0a..d275deb 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 @@ -69,19 +69,18 @@ public static MyUserInfoResponseDto of(User myUser, Parentchild parentchild) { } // 상대방이 탈퇴했을 경우 - public static MyUserInfoResponseDto of(User myUser, Parentchild parentchild, boolean isOpponentExit) { + public static MyUserInfoResponseDto of(User myUser, User opponentUser, Parentchild parentchild, QnA qnA, long date, int qnaCnt, boolean isOpponentExit) { return MyUserInfoResponseDto.builder() .myUsername(myUser.getUsername()) .myUserType(getUserType(parentchild.getRelation(), myUser.isMeChild())) - .opponentUserType(getUserType(parentchild.getRelation(), !myUser.isMeChild())) + .opponentUsername(opponentUser.getUsername()) + .opponentUserType(getUserType(parentchild.getRelation(), opponentUser.isMeChild())) .parentchildRelation(parentchild.getRelation().getValue()) .isMeChild(myUser.isMeChild()) - .section(QuestionSection.YOUNG.getValue()) - .matchedDate(0L) - .qnaCnt(0) - .inviteCode(parentchild.getInviteCode()) - .installUrl("http://umbba.site/") + .section(qnA.getQuestion().getSection().getValue()) + .matchedDate(date) // 일수와 문답 수는 다를 수 있음 + .qnaCnt(qnaCnt) .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 dc8f3c6..578491a 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 @@ -281,10 +281,6 @@ 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); @@ -296,6 +292,11 @@ public MyUserInfoResponseDto getUserInfo(final Long userId) { LocalDateTime firstQnADate = parentchild.getQnaList().get(0).getCreatedAt(); long qnaDate = ChronoUnit.DAYS.between(firstQnADate, LocalDateTime.now()); + // 상대 유저가 탈퇴했을 경우 + if (opponentUser.getSocialPlatform().equals(WITHDRAW)) { + return MyUserInfoResponseDto.of(myUser, opponentUser, parentchild, todayQnA, qnaDate, qnaCnt, true); + } + return MyUserInfoResponseDto.of(myUser, opponentUser, parentchild, todayQnA, qnaDate, qnaCnt); }