From ce92603adfb0a2a528b32f4293bd878a8dd15a8a Mon Sep 17 00:00:00 2001 From: ddongseop Date: Tue, 18 Jul 2023 23:21:00 +0900 Subject: [PATCH] =?UTF-8?q?[FEAT]=20isMatchFinish=20=ED=95=84=EB=93=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=ED=95=98=EC=97=AC=20=EC=B4=88=EB=8C=80=20?= =?UTF-8?q?=EB=B0=9B=EB=8A=94=EC=B8=A1=20=EB=B7=B0=20=EA=B5=AC=EB=B6=84=20?= =?UTF-8?q?#55?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parentchild/service/ParentchildService.java | 3 ++- .../dto/response/UserLoginResponseDto.java | 6 +++--- .../org/umbbaServer/domain/user/model/User.java | 16 +++++++++++----- .../domain/user/service/AuthService.java | 3 ++- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/main/java/sopt/org/umbbaServer/domain/parentchild/service/ParentchildService.java b/src/main/java/sopt/org/umbbaServer/domain/parentchild/service/ParentchildService.java index a8fea7bc..2a7ae883 100644 --- a/src/main/java/sopt/org/umbbaServer/domain/parentchild/service/ParentchildService.java +++ b/src/main/java/sopt/org/umbbaServer/domain/parentchild/service/ParentchildService.java @@ -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); } @@ -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 parentChildUsers = getParentChildUsers(newMatchRelation); diff --git a/src/main/java/sopt/org/umbbaServer/domain/user/controller/dto/response/UserLoginResponseDto.java b/src/main/java/sopt/org/umbbaServer/domain/user/controller/dto/response/UserLoginResponseDto.java index 679bed10..4aede703 100644 --- a/src/main/java/sopt/org/umbbaServer/domain/user/controller/dto/response/UserLoginResponseDto.java +++ b/src/main/java/sopt/org/umbbaServer/domain/user/controller/dto/response/UserLoginResponseDto.java @@ -14,7 +14,7 @@ public class UserLoginResponseDto { private Long userId; - private Boolean isNewUser; + private Boolean isMatchFinish; private String username; @@ -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()) diff --git a/src/main/java/sopt/org/umbbaServer/domain/user/model/User.java b/src/main/java/sopt/org/umbbaServer/domain/user/model/User.java index d4018adf..7baad18d 100644 --- a/src/main/java/sopt/org/umbbaServer/domain/user/model/User.java +++ b/src/main/java/sopt/org/umbbaServer/domain/user/model/User.java @@ -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) { @@ -58,7 +65,6 @@ public void updateFcmToken(String fcmToken) { this.fcmToken = fcmToken; } - // ** 소셜 로그인 관련 ** @Enumerated(EnumType.STRING) @Column(nullable = false) diff --git a/src/main/java/sopt/org/umbbaServer/domain/user/service/AuthService.java b/src/main/java/sopt/org/umbbaServer/domain/user/service/AuthService.java index 2fe684d7..1f065492 100644 --- a/src/main/java/sopt/org/umbbaServer/domain/user/service/AuthService.java +++ b/src/main/java/sopt/org/umbbaServer/domain/user/service/AuthService.java @@ -47,6 +47,7 @@ public UserLoginResponseDto login(String socialAccessToken, SocialLoginRequestDt .socialPlatform(socialPlatform) .socialId(socialId) .isMeChild(true) + .isMatchFinish(false) .fcmToken(request.getFcmToken()) .build(); @@ -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