Skip to content

Commit fd25476

Browse files
committed
MOSU fix: 프로필 등록한 카카오 중복 유저 업데이트
1 parent 2d536c3 commit fd25476

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/main/java/life/mosu/mosuserver/application/auth/processor/SignUpAccountStepProcessor.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,10 @@ private void validateForNewSignUp(UserJpaEntity user) {
3030

3131
userRepository.findByPhoneNumber(user.getOriginPhoneNumber())
3232
.ifPresent(existingUser -> {
33-
if (existingUser.isPendingUser()) {
34-
switch (existingUser.getProvider()) {
35-
case MOSU:
36-
throw new CustomRuntimeException(ErrorCode.USER_ALREADY_EXISTS);
37-
case KAKAO:
38-
throw new CustomRuntimeException(ErrorCode.KAKAO_DUPLICATED);
39-
}
33+
if (existingUser.isKakaoUser()) {
34+
throw new CustomRuntimeException(ErrorCode.KAKAO_DUPLICATED);
35+
} else if (existingUser.isPendingUser() && existingUser.isMosuUser()) {
36+
throw new CustomRuntimeException(ErrorCode.USER_ALREADY_EXISTS);
4037
}
4138
});
4239

src/main/java/life/mosu/mosuserver/domain/user/entity/UserJpaEntity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ public void updateUserInfo(
112112
public boolean isMosuUser() {
113113
return this.provider.equals(AuthProvider.MOSU);
114114
}
115+
116+
public boolean isKakaoUser() {
117+
return this.provider.equals(AuthProvider.KAKAO);
118+
}
115119

116120
public boolean isPendingUser() {
117121
return this.userRole.equals(UserRole.ROLE_PENDING);

0 commit comments

Comments
 (0)