Skip to content

Commit

Permalink
[fix] 일기 댓글 조회 시 신고한 일기 댓글 안보임 조건 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryeolee committed Sep 14, 2024
1 parent 5af0af4 commit df43b51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@ public interface DiaryRepository extends JpaRepository<Diary, Long> {
"JOIN FETCH dc.diary AS d " +
"JOIN FETCH d.myVeggie AS mv " +
"JOIN FETCH mv.user " +
"WHERE d.id = :diaryId")
List<DiaryComment> findDiaryById(@Param("diaryId") Long diaryId);
"LEFT JOIN diary_comment_report AS dcr ON dcr.diaryComment.id = dc.id AND dcr.user.id = :userId " +
"WHERE d.id = :diaryId " +
"AND dcr.id IS NULL"
)
List<DiaryComment> findDiaryByIdWithUserId(@Param("diaryId") Long diaryId, @Param("userId") Long userId);
@Query("SELECT new com.modernfarmer.farmusspring.domain.myveggiegarden.dto.SortedMyLikeDiary(d, " +
"CASE WHEN d.myVeggie.user.id = :userId THEN true ELSE false END, " +
"CASE WHEN dl.user.id = :userId THEN true ELSE false END) " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ public void verifyMyVeggie(Optional<MyVeggie> myVeggie){
@Transactional
public List<FarmClubDiary> findDiaryAccordingToFarmClub(Long farmClubId, Long userId) {
List<SortedMyLikeDiary> diaryList = diaryRepository.findDiaryByFarmClub(farmClubId, userId);
List<FarmClubDiary> proccessData = proccessFarmClubData(diaryList);
return proccessData;
return proccessFarmClubData(diaryList);
}
private List<FarmClubDiary> proccessFarmClubData(List<SortedMyLikeDiary> diaryAllList){
return diaryAllList.stream().map(allDiary -> {
Expand Down Expand Up @@ -195,7 +194,7 @@ public BaseResponseDto<SelectDiaryOneResponse> selectDiaryOne(MyVeggie myVeggie)
}
@Transactional
public DiaryInteractionsDto selectComment(Long userId, Long diaryId) {
List<DiaryComment> diaryCommentList = diaryRepository.findDiaryById(diaryId);
List<DiaryComment> diaryCommentList = diaryRepository.findDiaryByIdWithUserId(diaryId, userId);
List<DiaryCommentContent> diaryCommentContent = DiaryCommentContent.processData(diaryCommentList, userId);
int likeCount = diaryLikeRepository.findDiaryLikeCountById(diaryId);
int commentCount = diaryCommentRepository.findDiaryCommentCountById(diaryId);
Expand Down

0 comments on commit df43b51

Please sign in to comment.