Skip to content

Commit

Permalink
[feat] 신고 서비스 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
MinchoGreenT committed Sep 6, 2024
1 parent 9a21573 commit c3254ed
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,27 @@ public GetMissionPostCommentResponseDto getMissionPostComment(Long missionPostId
@Transactional
public void reportMissionPost(Long userId, Long missionPostId) {
MissionPost missionPost = missionPostHelper.getMissionPost(missionPostId);

MissionPostReport.createMissionPostReport(missionPost, userHelper.getUserEntity(userId));
int userCount = missionPost.getUserFarmClub().getFarmClub().getUserFarmClubs().size();
int reportCount = missionPost.getMissionPostReports().size();
if (userCount < 4 && reportCount >= 2) {
missionPostHelper.deleteMissionPost(missionPost);
} else if (reportCount >= 3) {
missionPostHelper.deleteMissionPost(missionPost);
}
}

@Transactional
public void reportMissionPostComment(Long userId, Long missionPostCommentId) {
MissionPostComment missionPostComment = missionPostHelper.getMissionPostComment(missionPostCommentId);

MissionPostCommentReport.createMissionPostCommentReport(missionPostComment, userHelper.getUserEntity(userId));
int userCount = missionPostComment.getMissionPost().getUserFarmClub().getFarmClub().getUserFarmClubs().size();
int reportCount = missionPostComment.getMissionPostCommentReports().size();
if (userCount < 4 && reportCount >= 2) {
missionPostHelper.deleteMissionPostComment(missionPostComment);
} else if (reportCount >= 3) {
missionPostHelper.deleteMissionPostComment(missionPostComment);
}
}

private MissionPost saveMissionPost(MissionPost missionPost) {
Expand Down

0 comments on commit c3254ed

Please sign in to comment.