feat(report): RESTful 신고 관리 API 및 DTO 유효성 검사 구현 refs #4 #5 #16 #17 #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
목적
변경 요약
핵심 기능
통합 신고 API 구현
referenceType필드로 신고 대상 타입 구분DTO 유효성 검사
RESTful API 설계
주요 파일/모듈
ReportController(통합 신고 관리 API)ReportRequest,ReportSearchRequest,ReportStatusUpdateRequestReportService,ReportServiceImpl(메서드 오버로딩)Report(hold 메서드 추가)ReportControllerTest(8개 테스트)API 명세
1. 신고 등록 (POST /api/v1/reports)
통합 API: 프로필, 게시글, 비즈니스 신고 모두 처리
Request Body:
{ "reporterId": "USER-001", "reportedId": "USER-002", "referenceType": "PROFILE", "reportCategory": "harassment", "reason": "욕설 및 비방" }Validation:
reporterId: 필수 (NotBlank)reportedId: 필수 (NotBlank)referenceType: 필수 (NotNull), ENUM(PROFILE, ARTICLE, BUSINESS)reportCategory: 필수 (NotBlank)reason: 필수 (NotBlank), 최대 500자Response (201 Created):
{ "reportId": "REPORT-001", "reporterId": "USER-001", "reportedId": "USER-002", "referenceType": "PROFILE", "reportCategory": "harassment", "reason": "욕설 및 비방", "status": "PENDING", "reportedAt": "2025-10-16T16:00:00" }2. 신고 상세 조회 (GET /api/v1/reports/{reportId})
Response (200 OK):
{ "reportId": "REPORT-001", "reporterId": "USER-001", "reportedId": "USER-002", "referenceType": "PROFILE", "reportCategory": "harassment", "reason": "욕설 및 비방", "status": "PENDING", "reportedAt": "2025-10-16T16:00:00", "processedAt": null }3. 신고 목록 검색 (GET /api/v1/reports)
Query Parameters:
status: PENDING | REVIEWING | APPROVED | REJECTED | WITHDRAWN (선택)referenceType: PROFILE | ARTICLE | BUSINESS (선택)reportCategory: 카테고리명 (선택)sortType: STATUS | REPORTED_AT (기본값: REPORTED_AT)sortDirection: ASC | DESC (기본값: DESC)cursor: 커서 (선택)size: 페이지 크기 (기본값: 20, 최소: 1, 최대: 100)Response (200 OK):
{ "content": [ { "reportId": "REPORT-001", "reporterId": "USER-001", "status": "PENDING", ... } ], "nextCursor": "2025-10-16T15:30:00", "size": 20, "hasNext": true }4. 신고 상태 변경 (PATCH /api/v1/reports/{reportId})
통합 API: 승인, 거절, 검토 시작, 보류 모두 처리
Request Body:
{ "status": "APPROVED", "adminId": "ADMIN-001", "comment": "승인 처리" }Validation:
status: 필수 (NotNull), ENUM(PENDING, REVIEWING, APPROVED, REJECTED, WITHDRAWN)adminId: 필수 (NotBlank)comment: 선택, 최대 500자Response (200 OK):
{ "reportId": "REPORT-001", "status": "APPROVED", "processedAt": "2025-10-16T16:10:00" }5. 신고 철회 (DELETE /api/v1/reports/{reportId})
Request Body:
{ "reporterId": "USER-001", "reason": "실수로 신고함" }Response (200 OK):
{ "reportId": "REPORT-001", "status": "WITHDRAWN" }수용 기준 검증
#4, #5 게시글/프로필 신고 기능 - AC 충족
추가 기능 요구사항
테스트 커버리지
브레이킹/마이그레이션
POST /api/v1/reports/{reportId}/approvePATCH /api/v1/reports/{reportId}(body에 status: APPROVED)POST /api/v1/reports/{reportId}/withdrawDELETE /api/v1/reports/{reportId}(body에 reporterId, reason)테스트
단위 테스트
수동 검증 방법
아키텍처 개선 사항
RESTful 설계 원칙 적용
DTO 유효성 검사 계층화
참조