Skip to content

Commit

Permalink
Merge pull request #51 from Mojacknong/fix_50/일기-댓글
Browse files Browse the repository at this point in the history
[fix] 일기 댓글 조회 조건 변경 / farmClubId 제거
  • Loading branch information
MinchoGreenT authored Jul 31, 2024
2 parents accc3fa + 3b5eb08 commit 052da71
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<DiaryCommentContent> diaryCommentList = myVeggieDiaryService.selectComment(user.getUserId(), diaryId, farmClubId);

@GetMapping(value = "/{diaryId}/comment")
public BaseResponseDto<?> selectComment(@AuthenticationPrincipal CustomUser user, @PathVariable("diaryId") Long diaryId) {
List<DiaryCommentContent> diaryCommentList = myVeggieDiaryService.selectComment(user.getUserId(), diaryId);
return BaseResponseDto.of(SuccessCode.SUCCESS, diaryCommentList);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ public interface DiaryRepository extends JpaRepository<Diary, Long> {
"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<DiaryComment> findDiary(@Param("diaryId") Long diaryId, @Param("farmClubId") Long farmClubId);
"WHERE d.id = :diaryId")
List<DiaryComment> findDiaryById(@Param("diaryId") Long diaryId);


@Query("SELECT d FROM diary AS d " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,8 @@ public BaseResponseDto<SelectDiaryOneResponse> selectDiaryOne(MyVeggie myVeggie)


@Transactional
public List<DiaryCommentContent> selectComment(
Long userId, Long diaryId, Long farmClubId
) {

List<DiaryComment> diaryCommentList = diaryRepository.findDiary(diaryId, farmClubId);
public List<DiaryCommentContent> selectComment(Long userId, Long diaryId) {
List<DiaryComment> diaryCommentList = diaryRepository.findDiaryById(diaryId);
List<DiaryCommentContent> diaryCommentContent = DiaryCommentContent.processData(diaryCommentList, userId);
return diaryCommentContent;
}
Expand Down

0 comments on commit 052da71

Please sign in to comment.