feat(board): 신고 목록 조회 API + 신고 무시(관리자)
- GET /api/board/reports — 글/댓글 신고 대상별 집계(UNION, 신고 많은 순) - POST /api/board/reports/dismiss — 블라인드 없이 신고 기록만 초기화 - 관리자 신고 관리 화면 백엔드 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import com.sb.web.board.dto.PostDetail;
|
||||
import com.sb.web.board.dto.PostRequest;
|
||||
import com.sb.web.board.dto.PostSummary;
|
||||
import com.sb.web.board.dto.Recommender;
|
||||
import com.sb.web.board.dto.ReportedItem;
|
||||
import com.sb.web.board.dto.VoteResponse;
|
||||
import com.sb.web.board.mapper.CommentMapper;
|
||||
import com.sb.web.board.mapper.PostMapper;
|
||||
@@ -293,6 +294,23 @@ public class BoardService {
|
||||
}
|
||||
}
|
||||
|
||||
/** 신고된 글/댓글 목록 (관리자 전용) — 대상별 신고 수 집계 */
|
||||
@Transactional(readOnly = true)
|
||||
public List<ReportedItem> listReportedItems(SessionUser user) {
|
||||
assertAdmin(user);
|
||||
return reportMapper.listReported();
|
||||
}
|
||||
|
||||
/** 신고 무시 (관리자 전용) — 블라인드 없이 신고 기록만 초기화 */
|
||||
@Transactional
|
||||
public void dismissReports(String targetType, Long targetId, SessionUser user) {
|
||||
assertAdmin(user);
|
||||
if (!T_POST.equals(targetType) && !T_COMMENT.equals(targetType)) {
|
||||
throw new ApiException(HttpStatus.BAD_REQUEST, "잘못된 신고 대상 유형입니다.");
|
||||
}
|
||||
reportMapper.deleteByTarget(targetType, targetId);
|
||||
}
|
||||
|
||||
/* ===================== 추천/비추천 ===================== */
|
||||
|
||||
/** 게시글 추천/비추천 토글. 같은 표 재요청 시 취소, 반대면 전환. */
|
||||
|
||||
Reference in New Issue
Block a user