-
Notifications
You must be signed in to change notification settings - Fork 8
feat: 신고 기능 구현 #402
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
feat: 신고 기능 구현 #402
Conversation
Walkthrough
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20분
Suggested reviewers
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
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 (
|
4be5a97 to
0d591bd
Compare
0d591bd to
bdc675c
Compare
whqtker
left a comment
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.
사용자는 특정 리소스를 한번만 신고 가능해야 한다고 생각해서 unique key 걸어주었습니다!
동의합니다 ! 고생하셨습니다 ~
| @@ -0,0 +1,14 @@ | |||
| package com.example.solidconnection.report.domain; | |||
|
|
|||
| public enum ReasonType { | |||
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.
제 생각엔 ReportType 또는 ReportReasonType 이 의미적으로 조금 더 와닿는 것 같습니다 ! GPA 제출에도 'reason' 관련 내용이 있기 때문에, 클래스명으로 분명하게 구분하는 것이 좋을 것 같습니다 !
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.
동의합니다!
게다가 기존에는 reason 이 문자열로 관리되고 있어서 더 헷갈릴만하겠네요.
ReportType 으로 이름 변경했습니다.
그리고 ReasonType 일 때보다 의미상 더 중요해졌다 생각해서 엔티티에서의 필드 위치 변경했습니다.🫡
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: 1
♻️ Duplicate comments (1)
src/main/java/com/example/solidconnection/report/domain/Report.java (1)
19-24: 데이터베이스 레벨 중복 방지가 완벽하게 구현되었습니다.
- 유니크 제약조건: 이전 리뷰 피드백이 반영되어
reporter_id,target_type,target_id조합으로 중복 신고를 방지합니다.- 명명 규칙: 제약조건에 명확한 이름(
uk_report_reporter_id_target_type_target_id)이 부여되었습니다.- 확장성: PR 목표에 맞게 다양한 타겟 타입을 지원할 수 있는 구조입니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/main/java/com/example/solidconnection/report/domain/Report.java(1 hunks)src/main/java/com/example/solidconnection/report/domain/ReportType.java(1 hunks)src/main/java/com/example/solidconnection/report/dto/ReportRequest.java(1 hunks)src/main/java/com/example/solidconnection/report/service/ReportService.java(1 hunks)src/main/resources/db/migration/V24__create_report_table.sql(1 hunks)src/test/java/com/example/solidconnection/report/fixture/ReportFixtureBuilder.java(1 hunks)src/test/java/com/example/solidconnection/report/service/ReportServiceTest.java(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- src/main/java/com/example/solidconnection/report/domain/ReportType.java
🚧 Files skipped from review as they are similar to previous changes (4)
- src/main/resources/db/migration/V24__create_report_table.sql
- src/test/java/com/example/solidconnection/report/fixture/ReportFixtureBuilder.java
- src/main/java/com/example/solidconnection/report/service/ReportService.java
- src/test/java/com/example/solidconnection/report/service/ReportServiceTest.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (3)
src/main/java/com/example/solidconnection/report/dto/ReportRequest.java (1)
7-17: 신고 요청 DTO 구조가 깔끔하게 설계되었습니다.
- Record 패턴 활용: 불변 객체로 설계되어 데이터 전송 용도에 적합합니다.
- 확장성 고려: PR 목표에서 언급한 채팅 기능 확장을 위한 구조가 잘 갖춰져 있습니다.
- 한국어 검증 메시지: 사용자 친화적인 에러 메시지가 제공됩니다.
src/main/java/com/example/solidconnection/report/domain/Report.java (2)
35-44: Enum 필드 매핑이 적절하게 구성되었습니다.
- STRING 타입 저장:
EnumType.STRING사용으로 데이터베이스 가독성과 유지보수성이 향상됩니다.- 명시적 컬럼명: 각 필드의 컬럼명이 명확하게 지정되어 있습니다.
- 타입 안정성: enum 타입 사용으로 유효하지 않은 값 입력을 방지합니다.
46-51: 생성자 구현이 깔끔합니다.모든 필수 필드를 받는 생성자가 제공되어 엔티티 생성이 명확합니다. ID는 자동 생성되므로 생성자에서 제외된 것이 적절합니다.
| @NotNull(message = "신고 대상을 포함해주세요.") | ||
| TargetType targetType, | ||
|
|
||
| long targetId |
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.
🛠️ Refactor suggestion
targetId 필드에 검증 로직 추가를 고려해보세요.
현재 targetId에는 검증 어노테이션이 없어 음수나 0값이 들어올 수 있습니다.
+ @Positive(message = "유효한 대상 ID를 입력해주세요.")
long targetId필요한 import도 추가해주세요:
+import jakarta.validation.constraints.Positive;🤖 Prompt for AI Agents
In src/main/java/com/example/solidconnection/report/dto/ReportRequest.java at
line 14, the targetId field lacks validation annotations, allowing invalid
values like negative numbers or zero. Add a validation annotation such as
@Positive to ensure targetId is a positive number, and include the necessary
import for this annotation from javax.validation.constraints or
jakarta.validation.constraints depending on the project setup.
whqtker
left a comment
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.
확인했습니다 ~! 👍
Gyuhyeok99
left a comment
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.
너무 깔끔하게 잘 나눠서 구현해주셔가지고 코드가 술술 읽혔습니다 ㅎㅎ
고생하셨습니다!! 신고 내역같은 건 어드민에서만 필요하니 나중에 구현해도 문제 없겠네요!
TargetType 추가한 거 너무 좋은 거 같습니다!!
관련 이슈
작업 내용
앱 출시를 대비하기 위해, 우선 순위가 올라간 "신고" 기능을 구현합니다.
특이 사항