Skip to content

Commit

Permalink
🐛 bug: validateExistsByDate diary가 있을 때 오류 던지도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
choihuk committed Aug 15, 2023
1 parent f7523a9 commit feb3334
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ public Diary validateDiaryById(Long diaryId, User user) {
}

public void validateExistsByDate(Long userId, LocalDate diaryDate) {
diaryRepository.getDiaryExistsByDiaryDate(userId, diaryDate)
.orElseThrow(DiaryDateAlreadyExistsException::new);
if (diaryRepository.getDiaryExistsByDiaryDate(userId, diaryDate).isPresent()) {
throw new DiaryDateAlreadyExistsException();
}
}

private void ownedByUser(Diary diary, User user) {
Expand Down

0 comments on commit feb3334

Please sign in to comment.