Skip to content

Conversation

@pokerbearkr
Copy link
Contributor

@pokerbearkr pokerbearkr commented Jun 25, 2025


작업 내용

  • 유저가 본인이 신고한 내역 조회 및 운영자가 처리시 남긴 메세지 확인 가능

변경 사항


트러블 슈팅


해결해야 할 문제


참고 사항


코드 리뷰 전 확인 체크리스트

  • 불필요한 콘솔 로그, 주석 제거
  • 커밋 메시지 컨벤션 준수 (type : )
  • 기능 정상 동작 확인

Summary by CodeRabbit

  • 신규 기능

    • 인증된 사용자가 자신의 신고 내역을 조회할 수 있는 새로운 API 엔드포인트(/api/reports/my)가 추가되었습니다.
  • 기능 개선

    • 신고 상태 변경 시 처리 메시지(resultMessage)를 함께 입력 및 저장할 수 있습니다.
    • 사용자별 신고 내역을 최신순으로 조회할 수 있습니다.
  • 버그 수정

    • 불필요한 import가 제거되었습니다.

@coderabbitai
Copy link

coderabbitai bot commented Jun 25, 2025

Walkthrough

신고(Report) 관련 기능이 확장되었습니다. 신고 엔티티에 처리 메시지(resultMessage) 필드가 추가되고, 상태 변경 시 해당 메시지를 함께 저장합니다. 사용자가 본인이 작성한 신고 목록을 조회할 수 있는 API가 새로 추가되었으며, 관련 DTO 및 서비스, 저장소, 컨트롤러가 수정 및 확장되었습니다.

Changes

파일/경로 요약 변경 내용 요약
.../application/report/dto/ReportMyResponse.java 신고 정보를 담는 DTO(레코드) 신설, 도메인 모델 변환용 from 메서드 추가
.../application/report/dto/ReportStatusUpdateRequest.java resultMessage 필드 추가
.../application/report/service/ReportService.java updateReportStatus에 resultMessage 전달, getMyReports(Long userId) 메서드 추가
.../domain/report/model/Report.java resultMessage 필드 및 updateStatus(ReportStatus, String) 메서드 추가 및 수정
.../domain/report/repository/ReportRepository.java findByReporterIdOrderByCreatedAtDesc(Long) 메서드 추가
.../presentation/report/ReportController.java GET /api/reports/my 엔드포인트 추가(본인 신고 목록 조회)
.../presentation/ranking/RankingController.java 불필요한 PointResponse import 제거

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>
Loading

Suggested labels

enhancement

Suggested reviewers

  • NCookies
  • Kimminu7
  • thezz9

Poem

🐇
신고의 기록, 메시지와 함께
토끼가 뛰어, 내 신고를 담네
컨트롤러에 새 길이 열리고
서비스는 내 말을 전하네
코드밭에 봄바람,
내 목소리도 이제 기록되리!
📝

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2ce16d7 and d82aede.

📒 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() 매개변수가 추가되어 운영자가 신고 처리 시 메시지를 남길 수 있는 기능이 구현되었습니다.

@pokerbearkr pokerbearkr merged commit 8dcf3ec into dev Jun 25, 2025
2 checks passed
@pokerbearkr pokerbearkr deleted the feat/userreport branch June 25, 2025 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants