Skip to content

Commit

Permalink
refactor: 필드 이름 isProfileRegistered로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
punchdrunkard committed Oct 8, 2024
1 parent e37e4e9 commit 5f32868
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
13 changes: 7 additions & 6 deletions src/main/java/com/odiga/fiesta/auth/service/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public ResponseEntity<BasicResponse<UserInfoResponse>> getUserInfo(@AuthUser Use
.nickname(user.getNickname())
.statusMessage(user.getStatusMessage())
.profileImage(user.getProfileImage())
.isProfileCreated(user.getUserTypeId() != null)
.isProfileRegistered(user.getUserTypeId() != null)
.userTypeId(user.getUserTypeId())
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
32 changes: 16 additions & 16 deletions src/main/java/com/odiga/fiesta/user/service/UserService.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,22 @@ public UserIdResponse updateUserInfo(User user, UserInfoUpdateRequest request) {
.build();
}

public UserOnboardingResponse getOnboardingInfo(User user) {
validateUser(user);

List<Long> categoryIds = userCategoryRepository.findCategoryIdsByUserId(user.getId());
List<Long> moodIds = userMoodRepository.findMoodIdsByUserId(user.getId());
List<Long> companionIds = userCompanionRepository.findCompanionIdsByUserId(user.getId());
List<Long> priorityIds = userPriorityRepository.findPriorityIdsByUserId(user.getId());

return UserOnboardingResponse.builder()
.categoryIds(categoryIds)
.moodIds(moodIds)
.companionIds(companionIds)
.priorityIds(priorityIds)
.build();
}

private void saveUserCompanions(final Long userId, List<Long> companionIds) {
userCompanionRepository.saveAll(
companionIds.stream()
Expand Down Expand Up @@ -161,22 +177,6 @@ private void saveUserPriorities(final Long userId, List<Long> priorityIds) {
);
}

public UserOnboardingResponse getOnboardingInfo(User user) {
validateUser(user);

List<Long> categoryIds = userCategoryRepository.findCategoryIdsByUserId(user.getId());
List<Long> moodIds = userMoodRepository.findMoodIdsByUserId(user.getId());
List<Long> companionIds = userCompanionRepository.findCompanionIdsByUserId(user.getId());
List<Long> priorityIds = userPriorityRepository.findPriorityIdsByUserId(user.getId());

return UserOnboardingResponse.builder()
.categoryIds(categoryIds)
.moodIds(moodIds)
.companionIds(companionIds)
.priorityIds(priorityIds)
.build();
}

private void validateCompanions(List<Long> companionIds) {
List<Companion> companions = companionRepository.findAllById(companionIds);
if (companions.size() != companionIds.size()) {
Expand Down

0 comments on commit 5f32868

Please sign in to comment.