Skip to content

Commit

Permalink
Merge pull request #149 from Team-Umbba/fix/#148-mypage_opponet_exit
Browse files Browse the repository at this point in the history
[FIX] 상대 유저 탈퇴를 알려주는 필드 추가
  • Loading branch information
ddongseop authored Apr 30, 2024
2 parents cb592f5 + d56651c commit 2713361
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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();
}

// 아직 매칭된 유저가 없는 경우
Expand All @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
}

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 2713361

Please sign in to comment.