diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/MissionPostRepositoryImpl.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/MissionPostRepositoryImpl.java index 6c8d3c0..316b1f9 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/MissionPostRepositoryImpl.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/MissionPostRepositoryImpl.java @@ -16,7 +16,9 @@ import static com.modernfarmer.farmusspring.domain.farmclub.entity.QFarmClub.farmClub; import static com.modernfarmer.farmusspring.domain.farmclub.entity.QMissionPost.missionPost; import static com.modernfarmer.farmusspring.domain.farmclub.entity.QMissionPostComment.missionPostComment; +import static com.modernfarmer.farmusspring.domain.farmclub.entity.QMissionPostCommentReport.missionPostCommentReport; import static com.modernfarmer.farmusspring.domain.farmclub.entity.QMissionPostLike.missionPostLike; +import static com.modernfarmer.farmusspring.domain.farmclub.entity.QMissionPostReport.missionPostReport; import static com.modernfarmer.farmusspring.domain.farmclub.entity.QUserFarmClub.userFarmClub; import static com.modernfarmer.farmusspring.domain.myveggiegarden.entity.QMyVeggie.myVeggie; import static com.modernfarmer.farmusspring.domain.user.entity.QUser.user; @@ -43,11 +45,17 @@ public List getMissionPostStepNumAndImage(Long farmClubId) @Override public GetMissionPostCommentResponseDto getMissionPostComment(Long missionPostId, Long userId) { + List reportCommentIds = queryFactory + .select(missionPostCommentReport.missionPostComment.id) + .from(missionPostCommentReport) + .where(missionPostCommentReport.user.id.eq(userId)) + .fetch(); + List comments = queryFactory .select(new QMissionPostCommentVo(missionPostComment, user, Expressions.constant(userId))) .from(missionPostComment) .join(missionPostComment.missionPost, missionPost) - .where(missionPost.id.eq(missionPostId)) + .where(missionPost.id.eq(missionPostId).and(missionPostComment.id.notIn(reportCommentIds))) .fetch(); Boolean isMyPost = queryFactory @@ -62,6 +70,12 @@ public GetMissionPostCommentResponseDto getMissionPostComment(Long missionPostId @Override public List getMissionPostList(Long userId, Long farmClubId) { + List reportMissionPostIds = queryFactory + .select(missionPostReport.missionPost.id) + .from(missionPostReport) + .where(missionPostReport.user.id.eq(userId)) + .fetch(); + return queryFactory .select(new QMissionPostVo( missionPost, @@ -82,7 +96,7 @@ public List getMissionPostList(Long userId, Long farmClubId) { .join(missionPost.userFarmClub, userFarmClub) .join(userFarmClub.myVeggie, myVeggie) .join(myVeggie.user, user) - .where(farmClub.id.eq(farmClubId)) + .where(farmClub.id.eq(farmClubId).and(missionPost.id.notIn(reportMissionPostIds))) .orderBy(missionPost.createdDate.desc()) .fetch(); }