Skip to content

Commit

Permalink
refactor: Diary queryById 추가 #24
Browse files Browse the repository at this point in the history
  • Loading branch information
masiljangajji committed Dec 8, 2024
1 parent 603548b commit d6a3361
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ public interface DiaryRepository extends JpaRepository<Diary, Long> {

Optional<FindDiaryResponse> findByUserIdAndIdAndIsDeletedFalse(Long userId,Long diaryId);

Diary queryById(Long diaryId);

}
2 changes: 1 addition & 1 deletion src/main/java/my/music/note/back/service/DiaryService.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void modifyDiary(Long diaryId, Long userId, DiaryModifyRequest diaryModif
throw new IllegalArgumentException();
}

Diary diary = diaryRepository.findById(diaryId).orElseThrow(IllegalArgumentException::new);
Diary diary = diaryRepository.queryById(diaryId);
diary.modifyDiaryContent(diaryModifyRequest);
}

Expand Down

0 comments on commit d6a3361

Please sign in to comment.