-
Notifications
You must be signed in to change notification settings - Fork 8
feat: 사용자 차단 관련 엔티티 및 DDL 작성 #507
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: 사용자 차단 관련 엔티티 및 DDL 작성 #507
Conversation
Walkthrough
Estimated code review effort🎯 2 (단순) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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. 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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/main/resources/db/migration/V32__add_user_block_table.sql (1)
9-9: 자기 차단 방지 로직 고려해보세요.현재 유니크 제약만으로는 사용자가 자기 자신을 차단하는 것을 막을 수 없습니다. blocker_id = blocked_id인 경우를 방지하려면 CHECK 제약을 추가하는 것을 고려해보세요.
CONSTRAINT uk_user_block_blocker_id_blocked_id UNIQUE (blocker_id, blocked_id), + CONSTRAINT ck_user_block_not_self CHECK (blocker_id != blocked_id),src/main/java/com/example/solidconnection/siteuser/domain/UserBlock.java (1)
32-36: SiteUser 엔티티 관계 매핑 고려사항현재는 단순 ID 참조로 구현했는데, 향후 확장성을 고려해 다음과 같은 옵션들을 검토해보세요:
- 현재 방식 유지: 성능상 유리하고 순환 참조 위험 없음
- @manytoone 관계 추가: 객체 지향적 접근이지만 지연 로딩 고려 필요
현재 방식이 차단 기능의 단순한 요구사항에는 적합해 보입니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/main/java/com/example/solidconnection/siteuser/domain/UserBlock.java(1 hunks)src/main/resources/db/migration/V32__add_user_block_table.sql(1 hunks)
⏰ 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/resources/db/migration/V32__add_user_block_table.sql (1)
1-12: 테이블 설계가 깔끔하고 완성도 높습니다!사용자 차단 기능을 위한 테이블 설계가 매우 잘 되어 있습니다. 다음과 같은 좋은 점들이 눈에 띕니다:
- 적절한 제약 조건 설정: 유니크 제약으로 중복 차단을 방지하고 외래키로 참조 무결성을 보장
- 명확한 네이밍: 제약 조건 이름들이 명확하고 일관적
- 타임스탬프 필드: created_at, updated_at으로 추적 가능성 확보
src/main/java/com/example/solidconnection/siteuser/domain/UserBlock.java (2)
16-26: 엔티티 구조가 간단명료합니다!BaseEntity 상속과 Lombok 활용으로 보일러플레이트 코드를 최소화했고, 유니크 제약 설정도 데이터베이스와 일치하게 잘 구성되어 있습니다.
32-36: 1: 변경 불필요
프로젝트 전반에서 외래키 참조(siteUserId, newsId 등)에 primitive long을 사용하고 있으며, UserBlock의 blockerId/blockedId도 이와 일관되므로 Long으로 감싸지 않고 그대로 유지해주세요.
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.
이거 알람이 안떠서 못봤네요 😭 얼른 이어서 작업하겠습니다!
관련 이슈
작업 내용
사용자 차단 관련 엔티티 및 DDL을 작성하였습니다.
(차단한 사람, 차단당한(?) 사람) 간 UK도 설정하였습니다.
간단한 코드라 부담없이 봐주세요 ~
특이 사항
리뷰 요구사항 (선택)