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

MNG-20 feat: 미션 댓글 신고하기 #287

Merged
merged 1 commit into from
May 16, 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 @@ -12,6 +12,8 @@
import com.moing.backend.domain.missionArchive.domain.entity.MissionArchive;
import com.moing.backend.domain.missionArchive.domain.entity.MissionArchiveStatus;
import com.moing.backend.domain.missionArchive.domain.service.MissionArchiveQueryService;
import com.moing.backend.domain.missionComment.domain.entity.MissionComment;
import com.moing.backend.domain.missionComment.domain.service.MissionCommentGetService;
import com.moing.backend.domain.report.application.mapper.ReportMapper;
import com.moing.backend.domain.report.domain.entity.Report;
import com.moing.backend.domain.report.domain.entity.constant.ReportType;
Expand All @@ -31,6 +33,7 @@ public class ReportCreateUseCase {
private final BoardGetService boardGetService;
private final MissionArchiveQueryService missionArchiveQueryService;
private final BoardCommentGetService boardCommentGetService;
private final MissionCommentGetService missionCommentGetService;

private final String REPORT_BOARD_TITLE ="신고 접수된 게시물입니다.";
private final String REPORT_BOARD_MESSAGE ="신고 접수로 삭제된 게시물입니다.";
Expand All @@ -53,12 +56,17 @@ public Long createReport(String socialId, Long targetId, String reportType) {
.isNotice(board.isNotice())
.build());
}
else if (reportType.equals(ReportType.COMMENT.name())) {
else if (reportType.equals(ReportType.BCOMMENT.name())) {
BoardComment boardComment = boardCommentGetService.getComment(targetId);
targetMemberNickName = boardComment.getTeamMember().getMember().getNickName();
boardComment.updateContent(REPORT_BOARD_MESSAGE);

} else {
} else if(reportType.equals(ReportType.MCOMMENT.name())){
MissionComment missionComment=missionCommentGetService.getComment(targetId);
targetMemberNickName=missionComment.getTeamMember().getMember().getNickName();
missionComment.updateContent(REPORT_BOARD_MESSAGE);
}
else {

MissionArchive missionArchive = missionArchiveQueryService.findByMissionArchiveId(targetId);
Mission mission = missionArchive.getMission();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.moing.backend.domain.report.domain.entity.constant;

public enum ReportType {
MISSION,BOARD,COMMENT
MISSION, BOARD, BCOMMENT, MCOMMENT
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

import com.moing.backend.config.CommonControllerTest;
import com.moing.backend.domain.report.application.service.ReportCreateUseCase;
import com.moing.backend.domain.teamScore.application.dto.TeamScoreRes;
import com.moing.backend.domain.teamScore.presentation.TeamScoreController;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
Expand All @@ -14,8 +11,6 @@
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;

import static com.moing.backend.domain.report.presentation.constant.ReportResponseMessage.CREATE_REPORT_SUCCESS;
import static com.moing.backend.domain.teamScore.presentation.constant.TeamScoreResponseMessage.GET_TEAMSCORE_SUCCESS;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.springframework.restdocs.headers.HeaderDocumentation.headerWithName;
Expand Down Expand Up @@ -59,7 +54,7 @@ public class ReportControllerTest extends CommonControllerTest {
),

pathParameters(
parameterWithName("reportType").description("MISSION/BOARD/COMMENT"),
parameterWithName("reportType").description("MISSION/BOARD/BCOMMENT/MCOMMENT"),
parameterWithName("targetId").description("신고할 board,missionArchive,comment 아이디")
),

Expand Down
Loading