Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DEPLOY] 운영서버 v1.1.0 수정사항 배포 #150

Merged
merged 5 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

## 🔧 시스템 아키텍처

<img width="950" src="https://user-images.githubusercontent.com/80024278/254716740-eaf5b1e6-b16d-4fc9-88e3-7e7c14dd56dd.png">
<img width="950" src="https://github.com/Team-Umbba/Umbba-Server/assets/67463603/37660431-f7db-435a-9456-3e2ff9036b72">

<hr>

Expand Down
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,24 @@ 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, User opponentUser, Parentchild parentchild, QnA qnA, long date, int qnaCnt, boolean isOpponentExit) {

return MyUserInfoResponseDto.builder()
.myUsername(myUser.getUsername())
.myUserType(getUserType(parentchild.getRelation(), myUser.isMeChild()))
.opponentUsername(opponentUser.getUsername())
.opponentUserType(getUserType(parentchild.getRelation(), opponentUser.isMeChild()))
.parentchildRelation(parentchild.getRelation().getValue())
.isMeChild(myUser.isMeChild())
.section(qnA.getQuestion().getSection().getValue())
.matchedDate(date) // 일수와 문답 수는 다를 수 있음
.qnaCnt(qnaCnt)
.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,7 @@ public MyUserInfoResponseDto getUserInfo(final Long userId) {
}

User opponentUser = getOpponentByParentchild(parentchild, userId);

QnA todayQnA = getTodayQnAByParentchild(parentchild);

int qnaCnt = parentchild.getCount();
Expand All @@ -290,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);
}

Expand Down
Loading