Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] 일기 댓글 조회 조건 변경 / farmClubId 제거 #51

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading