Skip to content

Commit

Permalink
[FEAT] isMatchFinish 필드 추가하여 초대 받는측 뷰 구분 #55
Browse files Browse the repository at this point in the history
  • Loading branch information
ddongseop committed Jul 18, 2023
1 parent 9d4abef commit ce92603
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public OnboardingInviteResponseDto onboardInvite(Long userId, OnboardingInviteRe
.build();
parentchildRepository.save(parentchild);
user.updateParentchild(parentchild);

user.updateIsMatchFinish(true);
log.info("userInfo: {}", request.getUserInfo().getBornYear());
return OnboardingInviteResponseDto.of(parentchild, user);
}
Expand Down Expand Up @@ -138,6 +138,7 @@ public InviteResultResponseDto matchRelation(Long userId, InviteCodeRequestDto r
// TODO ParentChild에 연관된 User 수에 따른 예외처리
// TODO 하나의 유저는 하나의 관계만 가지도록 예외처리
user.updateParentchild(newMatchRelation);
user.updateIsMatchFinish(true);
log.info("로그인한 유저가 성립된 Parentchild Id: {}", user.getParentChild().getId());

List<User> parentChildUsers = getParentChildUsers(newMatchRelation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class UserLoginResponseDto {
private Long userId;

private Boolean isNewUser;
private Boolean isMatchFinish;

private String username;

Expand All @@ -36,12 +36,12 @@ public class UserLoginResponseDto {

// private String socialRefreshToken;

public static UserLoginResponseDto of(boolean isRegistered, User loginUser, String accessToken) {
public static UserLoginResponseDto of(User loginUser, String accessToken) {
TokenDto tokenDto = TokenDto.of(accessToken, loginUser.getRefreshToken());

return UserLoginResponseDto.builder()
.userId(loginUser.getId())
.isNewUser(!isRegistered) // 만약 등록이 안되어있던 회원이면 isNewUser을 true로 설정
.isMatchFinish(loginUser.isMatchFinish())
.username(loginUser.getUsername())
.gender(loginUser.getGender())
.bornYear(loginUser.getBornYear())
Expand Down
16 changes: 11 additions & 5 deletions src/main/java/sopt/org/umbbaServer/domain/user/model/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,24 @@ public class User extends AuditingTimeEntity {
@JoinColumn(name = "parentchild_id")
private Parentchild parentChild;

@Column(nullable = false)
private boolean isMeChild;

public void updateParentchild(Parentchild parentchild) {
this.parentChild = parentchild;
}


@Column(nullable = false)
private boolean isMeChild;

public void updateIsMeChild(boolean isMeChild) {
this.isMeChild = isMeChild;
}

@Column(nullable = false)
private boolean isMatchFinish;

public void updateIsMatchFinish(boolean isMatchFinish) {
this.isMatchFinish = isMatchFinish;
}

private String refreshToken;

public void updateRefreshToken(String refreshToken) {
Expand All @@ -58,7 +65,6 @@ public void updateFcmToken(String fcmToken) {
this.fcmToken = fcmToken;
}


// ** 소셜 로그인 관련 **
@Enumerated(EnumType.STRING)
@Column(nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public UserLoginResponseDto login(String socialAccessToken, SocialLoginRequestDt
.socialPlatform(socialPlatform)
.socialId(socialId)
.isMeChild(true)
.isMatchFinish(false)
.fcmToken(request.getFcmToken())
.build();

Expand All @@ -66,7 +67,7 @@ public UserLoginResponseDto login(String socialAccessToken, SocialLoginRequestDt
// 클라이언트 요청에 따라 FCM 토큰을 로그인할 때마다 업데이트 하도록 변경
loginUser.updateFcmToken(request.getFcmToken());

return UserLoginResponseDto.of(isRegistered, loginUser, tokenDto.getAccessToken());
return UserLoginResponseDto.of(loginUser, tokenDto.getAccessToken());
}

@Transactional
Expand Down

0 comments on commit ce92603

Please sign in to comment.