diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/MyVeggieDiaryController.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/MyVeggieDiaryController.java index e9efd747..9fc60d7f 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/MyVeggieDiaryController.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/MyVeggieDiaryController.java @@ -105,14 +105,9 @@ public BaseResponseDto cancelLike( return BaseResponseDto.of(SuccessCode.SUCCESS, null); } - @GetMapping(value = "/{diaryId}/{farmClubId}/comment") - public BaseResponseDto selectComment( - @AuthenticationPrincipal CustomUser user, - @PathVariable("diaryId") Long diaryId, - @PathVariable("farmClubId") Long farmClubId - ) { - List diaryCommentList = myVeggieDiaryService.selectComment(user.getUserId(), diaryId, farmClubId); - + @GetMapping(value = "/{diaryId}/comment") + public BaseResponseDto selectComment(@AuthenticationPrincipal CustomUser user, @PathVariable("diaryId") Long diaryId) { + List diaryCommentList = myVeggieDiaryService.selectComment(user.getUserId(), diaryId); return BaseResponseDto.of(SuccessCode.SUCCESS, diaryCommentList); } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/repository/DiaryRepository.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/repository/DiaryRepository.java index 68481a3d..f4586d98 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/repository/DiaryRepository.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/repository/DiaryRepository.java @@ -32,9 +32,8 @@ public interface DiaryRepository extends JpaRepository { "JOIN FETCH dc.diary AS d " + "JOIN FETCH d.myVeggie AS mv " + "JOIN FETCH mv.user " + - "JOIN FETCH d.farmClub " + - "WHERE d.id = :diaryId AND d.farmClub.id = :farmClubId AND d.isOpen = true") - List findDiary(@Param("diaryId") Long diaryId, @Param("farmClubId") Long farmClubId); + "WHERE d.id = :diaryId") + List findDiaryById(@Param("diaryId") Long diaryId); @Query("SELECT d FROM diary AS d " + diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/MyVeggieDiaryService.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/MyVeggieDiaryService.java index 0f1dd7e3..139b848d 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/MyVeggieDiaryService.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/MyVeggieDiaryService.java @@ -156,11 +156,8 @@ public BaseResponseDto selectDiaryOne(MyVeggie myVeggie) @Transactional - public List selectComment( - Long userId, Long diaryId, Long farmClubId - ) { - - List diaryCommentList = diaryRepository.findDiary(diaryId, farmClubId); + public List selectComment(Long userId, Long diaryId) { + List diaryCommentList = diaryRepository.findDiaryById(diaryId); List diaryCommentContent = DiaryCommentContent.processData(diaryCommentList, userId); return diaryCommentContent; }