Skip to content

Commit

Permalink
Merge pull request #126 from Team-Umbba/feat/#117-mypage_api
Browse files Browse the repository at this point in the history
  • Loading branch information
jun02160 authored Feb 21, 2024
2 parents 2261d87 + c632c87 commit 7e04635
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@

import static sopt.org.umbba.domain.domain.parentchild.ParentchildRelation.*;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import lombok.Builder;
import lombok.Getter;
import sopt.org.umbba.domain.domain.parentchild.Parentchild;
import sopt.org.umbba.domain.domain.parentchild.ParentchildRelation;
import sopt.org.umbba.domain.domain.qna.QnA;
import sopt.org.umbba.domain.domain.qna.QuestionSection;
import sopt.org.umbba.domain.domain.user.User;

@Getter
@Builder
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class MyUserInfoResponseDto {

private String myUsername;
Expand Down Expand Up @@ -47,10 +44,14 @@ public static MyUserInfoResponseDto of(User myUser, User opponentUser, Parentchi
}

// 아직 매칭된 유저가 없는 경우
public static MyUserInfoResponseDto of(User myUser) {
public static MyUserInfoResponseDto of(User myUser, Parentchild parentchild) {

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).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public MyUserInfoResponseDto getUserInfo(final Long userId) {

// 매칭된 상대 유저가 없는 경우
if (opponentUserList.isEmpty()) {
return MyUserInfoResponseDto.of(myUser);
return MyUserInfoResponseDto.of(myUser, parentchild);
}

User opponentUser = getOpponentByParentchild(parentchild, userId);
Expand Down

0 comments on commit 7e04635

Please sign in to comment.