Skip to content

Conversation

@whqtker
Copy link
Member

@whqtker whqtker commented Sep 18, 2025

관련 이슈

작업 내용

사용자 차단 관련 엔티티 및 DDL을 작성하였습니다.
(차단한 사람, 차단당한(?) 사람) 간 UK도 설정하였습니다.
간단한 코드라 부담없이 봐주세요 ~

특이 사항

리뷰 요구사항 (선택)

@coderabbitai
Copy link

coderabbitai bot commented Sep 18, 2025

Walkthrough

    1. User 차단 도메인 추가
    • 사용자 간 차단 관계를 표현하는 UserBlock JPA 엔터티가 추가되었습니다. 단일 PK(id)와 blockerId, blockedId 필드, 그리고 (blocker_id, blocked_id) 유니크 제약이 포함됩니다.
    1. DB 스키마 마이그레이션 추가
    • user_block 테이블 생성 마이그레이션이 추가되었습니다. id PK, blocker_id/blocked_id FK, created_at/updated_at 타임스탬프, (blocker_id, blocked_id) 유니크 인덱스를 정의합니다.

Estimated code review effort

🎯 2 (단순) | ⏱️ ~10 minutes

  • 이유: 신규 엔터티 1개와 대응하는 단일 SQL 마이그레이션 추가로 변화가 제한적이며, 로직 밀도 낮고 패턴이 명확합니다.

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title Check ✅ Passed PR 제목인 “feat: 사용자 차단 관련 엔티티 및 DDL 작성”은 사용자 차단 기능을 위한 엔티티와 데이터베이스 스키마 변경이라는 핵심 변경사항을 간결하고 명확하게 요약하고 있어 기준을 충족합니다.
Linked Issues Check ✅ Passed 본 PR은 링크된 이슈 #506에서 요구한 “차단 관련 엔티티 작성” 및 “차단 관련 DDL 작성” 목표를 모두 구현하여 해당 요구사항을 충족합니다.
Out of Scope Changes Check ✅ Passed PR 변경사항은 UserBlock 엔티티 추가와 해당 테이블 생성을 위한 DDL 작성으로 이슈 #506 범위 내에서만 이루어져 있으며 다른 무관한 변경이 없습니다.
Description Check ✅ Passed 제안된 PR 설명에는 관련 이슈(#506) 링크와 작업 내용에 대한 구체적인 설명이 포함되어 있어 템플릿의 필수 섹션을 충족하며 특이 사항과 리뷰 요구사항 섹션도 구조적으로 존재하므로 전반적으로 충분합니다.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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/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 참조로 구현했는데, 향후 확장성을 고려해 다음과 같은 옵션들을 검토해보세요:

  1. 현재 방식 유지: 성능상 유리하고 순환 참조 위험 없음
  2. @manytoone 관계 추가: 객체 지향적 접근이지만 지연 로딩 고려 필요

현재 방식이 차단 기능의 단순한 요구사항에는 적합해 보입니다.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4329673 and b799b9f.

📒 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: 테이블 설계가 깔끔하고 완성도 높습니다!

사용자 차단 기능을 위한 테이블 설계가 매우 잘 되어 있습니다. 다음과 같은 좋은 점들이 눈에 띕니다:

  1. 적절한 제약 조건 설정: 유니크 제약으로 중복 차단을 방지하고 외래키로 참조 무결성을 보장
  2. 명확한 네이밍: 제약 조건 이름들이 명확하고 일관적
  3. 타임스탬프 필드: 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으로 감싸지 않고 그대로 유지해주세요.

Copy link
Contributor

@Gyuhyeok99 Gyuhyeok99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 알람이 안떠서 못봤네요 😭 얼른 이어서 작업하겠습니다!

@whqtker whqtker merged commit ff6f22e into solid-connection:develop Sep 23, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: 차단 관련 엔티티 및 DDL 작성

3 participants