diff --git a/src/main/java/com/odiga/fiesta/auth/service/AuthService.java b/src/main/java/com/odiga/fiesta/auth/service/AuthService.java index f204a5fc..9cfe7098 100644 --- a/src/main/java/com/odiga/fiesta/auth/service/AuthService.java +++ b/src/main/java/com/odiga/fiesta/auth/service/AuthService.java @@ -83,17 +83,12 @@ public LoginResponse kakaoLogin(String accessTokenByClient) { .build(); } + @Transactional public void deleteUser(User user) { checkLogin(user); userRepository.deleteById(user.getId()); } - private static void validateKakaoAcccount(KakaoAccount kakaoAccount) { - if (!kakaoAccount.isHasEmail()) { - throw new CustomException(CAN_NOT_FIND_KAKAO_USER); - } - } - // JWT 토큰 재발급 @Transactional public TokenReissueResponse reissue(String refreshToken) { @@ -145,6 +140,12 @@ private User saveUser(String email) { return savedUser; } + private static void validateKakaoAcccount(KakaoAccount kakaoAccount) { + if (!kakaoAccount.isHasEmail()) { + throw new CustomException(CAN_NOT_FIND_KAKAO_USER); + } + } + private UserRole saveUserRole(Role role, User savedUser) { UserRole userRole = UserRole.builder() .roleId(role.getId()) diff --git a/src/main/java/com/odiga/fiesta/user/controller/UserController.java b/src/main/java/com/odiga/fiesta/user/controller/UserController.java index a8e1c13b..aa43d9bb 100644 --- a/src/main/java/com/odiga/fiesta/user/controller/UserController.java +++ b/src/main/java/com/odiga/fiesta/user/controller/UserController.java @@ -82,7 +82,7 @@ public ResponseEntity> getUserInfo(@AuthUser Use .nickname(user.getNickname()) .statusMessage(user.getStatusMessage()) .profileImage(user.getProfileImage()) - .isProfileCreated(user.getUserTypeId() != null) + .isProfileRegistered(user.getUserTypeId() != null) .userTypeId(user.getUserTypeId()) .build(); diff --git a/src/main/java/com/odiga/fiesta/user/dto/response/UserInfoResponse.java b/src/main/java/com/odiga/fiesta/user/dto/response/UserInfoResponse.java index c3750a0c..74c2aaa8 100644 --- a/src/main/java/com/odiga/fiesta/user/dto/response/UserInfoResponse.java +++ b/src/main/java/com/odiga/fiesta/user/dto/response/UserInfoResponse.java @@ -12,6 +12,6 @@ public class UserInfoResponse { private String nickname; private String statusMessage; private String profileImage; - private Boolean isProfileCreated; + private Boolean isProfileRegistered; private Long userTypeId; } diff --git a/src/main/java/com/odiga/fiesta/user/service/UserService.java b/src/main/java/com/odiga/fiesta/user/service/UserService.java index cf207da6..67b1b137 100644 --- a/src/main/java/com/odiga/fiesta/user/service/UserService.java +++ b/src/main/java/com/odiga/fiesta/user/service/UserService.java @@ -145,6 +145,22 @@ private UserType createUserType(User user, ProfileCreateRequest request) { return userType; } + public UserOnboardingResponse getOnboardingInfo(User user) { + validateUser(user); + + List categoryIds = userCategoryRepository.findCategoryIdsByUserId(user.getId()); + List moodIds = userMoodRepository.findMoodIdsByUserId(user.getId()); + List companionIds = userCompanionRepository.findCompanionIdsByUserId(user.getId()); + List priorityIds = userPriorityRepository.findPriorityIdsByUserId(user.getId()); + + return UserOnboardingResponse.builder() + .categoryIds(categoryIds) + .moodIds(moodIds) + .companionIds(companionIds) + .priorityIds(priorityIds) + .build(); + } + private void saveUserCompanions(final Long userId, List companionIds) { userCompanionRepository.saveAll( companionIds.stream() @@ -189,22 +205,6 @@ private void saveUserPriorities(final Long userId, List priorityIds) { ); } - public UserOnboardingResponse getOnboardingInfo(User user) { - validateUser(user); - - List categoryIds = userCategoryRepository.findCategoryIdsByUserId(user.getId()); - List moodIds = userMoodRepository.findMoodIdsByUserId(user.getId()); - List companionIds = userCompanionRepository.findCompanionIdsByUserId(user.getId()); - List priorityIds = userPriorityRepository.findPriorityIdsByUserId(user.getId()); - - return UserOnboardingResponse.builder() - .categoryIds(categoryIds) - .moodIds(moodIds) - .companionIds(companionIds) - .priorityIds(priorityIds) - .build(); - } - private void validateCompanions(List companionIds) { List companions = companionRepository.findAllById(companionIds); if (companions.size() != companionIds.size()) {