Skip to content

Commit

Permalink
feat: 프로필 수정시 사용자 나이 검증 로직 수정(#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
Minjae-An committed May 1, 2024
1 parent 1179b45 commit 7d4ae23
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions be/src/main/java/yeonba/be/mypage/service/MyPageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,10 @@ public void updateProfile(UserUpdateProfileRequest request, long userId) {
User user = userQuery.findById(userId);
UserPreference userPreference = userPreferenceQuery.findByUser(user);

// 생년월일 업데이트시 성인(만 18세 이상)인 지 검증, 새로운 나이 계산
// 생년월일 업데이트시 20~40세인 지 검증, 새로운 나이 계산
LocalDate birth = request.getBirth();
LocalDate currentDate = LocalDate.now();
if (AgeValidator.isNotAdult(birth, currentDate)) {
throw new GeneralException(UserException.IS_NOT_ADULT);
}
AgeValidator.validateAgeByBirth(birth, currentDate);
int age = Period.between(birth, currentDate).getYears();

// 음역대, 선호하는 음역대 조회
Expand Down

0 comments on commit 7d4ae23

Please sign in to comment.