-
Notifications
You must be signed in to change notification settings - Fork 3
feat : 유저 본인 신고 내역 조회, 운영자가 처리시 메세지 입력 가능 #101
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
Conversation
Walkthrough신고(Report) 관련 기능이 확장되었습니다. 신고 엔티티에 처리 메시지(resultMessage) 필드가 추가되고, 상태 변경 시 해당 메시지를 함께 저장합니다. 사용자가 본인이 작성한 신고 목록을 조회할 수 있는 API가 새로 추가되었으며, 관련 DTO 및 서비스, 저장소, 컨트롤러가 수정 및 확장되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ReportController
participant ReportService
participant ReportRepository
User->>ReportController: GET /api/reports/my (with AuthUser)
ReportController->>ReportService: getMyReports(userId)
ReportService->>ReportRepository: findByReporterIdOrderByCreatedAtDesc(userId)
ReportRepository-->>ReportService: List<Report>
ReportService-->>ReportController: List<ReportMyResponse>
ReportController-->>User: 200 OK + List<ReportMyResponse>
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/main/java/org/ezcode/codetest/application/report/dto/ReportMyResponse.java (1)
16-28: Factory 메서드 구현 우수하지만 날짜 포맷팅 개선 고려Static factory 메서드 패턴을 적절히 사용했습니다. 다만
createdAt.toString()보다는 더 사용자 친화적인 날짜 포맷팅을 고려해보세요.다음과 같이 날짜 포맷팅을 개선할 수 있습니다:
+import java.time.format.DateTimeFormatter; + +private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - r.getCreatedAt().toString() + r.getCreatedAt().format(FORMATTER)src/main/java/org/ezcode/codetest/application/report/service/ReportService.java (1)
100-105: 페이징 처리를 고려해보세요.사용자 본인 신고 내역 조회 기능이 잘 구현되었습니다. 다만 현재 구현은 해당 사용자의 모든 신고를 반환하므로, 신고 건수가 많은 사용자의 경우 성능 문제가 발생할 수 있습니다.
향후 사용자 경험 개선을 위해 페이징 처리를 고려해보시기 바랍니다.
페이징을 적용한 대안 구현:
@Transactional(readOnly = true) -public List<ReportMyResponse> getMyReports(Long userId) { - return reportRepository.findByReporterIdOrderByCreatedAtDesc(userId).stream() - .map(ReportMyResponse::from) - .toList(); +public Page<ReportMyResponse> getMyReports(Long userId, Pageable pageable) { + return reportRepository.findByReporterIdOrderByCreatedAtDesc(userId, pageable) + .map(ReportMyResponse::from); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/main/java/org/ezcode/codetest/application/report/dto/ReportMyResponse.java(1 hunks)src/main/java/org/ezcode/codetest/application/report/dto/ReportStatusUpdateRequest.java(1 hunks)src/main/java/org/ezcode/codetest/application/report/service/ReportService.java(2 hunks)src/main/java/org/ezcode/codetest/domain/report/model/Report.java(2 hunks)src/main/java/org/ezcode/codetest/domain/report/repository/ReportRepository.java(1 hunks)src/main/java/org/ezcode/codetest/presentation/ranking/RankingController.java(0 hunks)src/main/java/org/ezcode/codetest/presentation/report/ReportController.java(3 hunks)
💤 Files with no reviewable changes (1)
- src/main/java/org/ezcode/codetest/presentation/ranking/RankingController.java
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build
🔇 Additional comments (9)
src/main/java/org/ezcode/codetest/domain/report/repository/ReportRepository.java (1)
6-6: 적절한 Repository 메서드 추가Spring Data JPA의 네이밍 컨벤션을 잘 따르고 있으며, 메서드명이 기능을 명확하게 표현합니다.
Also applies to: 9-9
src/main/java/org/ezcode/codetest/application/report/dto/ReportStatusUpdateRequest.java (1)
9-9: resultMessage 필드 검증 요구사항 확인 필요
resultMessage필드에 검증 어노테이션이 없습니다. 운영자 처리 메시지가 필수인지 선택사항인지에 따라@NotBlank또는 길이 제한 검증을 추가하는 것을 고려해보세요.비즈니스 요구사항에 따라 해당 필드의 검증 규칙을 확인해주세요.
src/main/java/org/ezcode/codetest/presentation/report/ReportController.java (2)
6-6: 적절한 import 추가새로운 기능에 필요한 import가 정확히 추가되었습니다.
Also applies to: 18-18
36-41: 사용자 본인 신고 내역 조회 엔드포인트 구현 완료
@AuthenticationPrincipal을 사용하여 인증된 사용자의 신고 내역만 조회할 수 있도록 적절히 구현되었습니다. REST API 설계 원칙을 잘 따르고 있습니다.src/main/java/org/ezcode/codetest/domain/report/model/Report.java (2)
39-40: 운영자 처리 메시지 필드 추가
resultMessage필드가 적절한 데이터베이스 제약조건과 함께 추가되었습니다. 길이 제한(255자)이 합리적입니다.
58-61: updateStatus 메서드 개선상태 업데이트 시 처리 메시지도 함께 저장할 수 있도록 메서드가 적절히 수정되었습니다. 도메인 로직의 일관성을 유지하고 있습니다.
src/main/java/org/ezcode/codetest/application/report/dto/ReportMyResponse.java (1)
5-15: Record를 활용한 깔끔한 DTO 구조Java Record를 사용하여 간결하게 DTO를 구현했습니다. 모든 필요한 필드가 포함되어 있고 구조가 명확합니다.
src/main/java/org/ezcode/codetest/application/report/service/ReportService.java (2)
14-14: Import 추가가 적절합니다.새로 추가된
getMyReports메서드에서List<ReportMyResponse>를 반환하기 위해 필요한 import입니다.
97-97: 운영자 메시지 기능이 올바르게 구현되었습니다.
report.updateStatus호출에req.resultMessage()매개변수가 추가되어 운영자가 신고 처리 시 메시지를 남길 수 있는 기능이 구현되었습니다.
작업 내용
변경 사항
트러블 슈팅
해결해야 할 문제
참고 사항
코드 리뷰 전 확인 체크리스트
type :)Summary by CodeRabbit
신규 기능
/api/reports/my)가 추가되었습니다.기능 개선
버그 수정