Skip to content
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: AttendanceV2 도메인 구현 #935

Merged
merged 2 commits into from
Feb 26, 2025

Conversation

Sangwook02
Copy link
Member

@Sangwook02 Sangwook02 commented Feb 26, 2025

🌱 관련 이슈

📌 작업 내용 및 특이사항

📝 참고사항

📚 기타

Summary by CodeRabbit

  • New Features
    • 학습 세션에 참여한 학생들의 출석 내역을 보다 정확하고 효율적으로 관리할 수 있는 새로운 출석 기능이 도입되었습니다.

@Sangwook02 Sangwook02 self-assigned this Feb 26, 2025
@Sangwook02 Sangwook02 requested a review from a team as a code owner February 26, 2025 12:34
@Sangwook02 Sangwook02 added the ✨ feature 새로운 기능 추가 및 수정 label Feb 26, 2025
Copy link

coderabbitai bot commented Feb 26, 2025

📝 Walkthrough

"""

Walkthrough

새로운 JPA 엔티티 클래스인 AttendanceV2가 추가되었습니다. 이 클래스는 BaseEntity를 상속하며, 데이터베이스의 attendance_v2 테이블에 매핑됩니다. 주요 필드로는 id, student, studySession이 포함되며, studentstudySession은 각각 MemberStudySessionV2 엔티티와의 다대일 관계로 설정되어 있습니다. 또한, builder 패턴을 통한 객체 생성을 지원하며, 정적 팩토리 메서드 create를 제공하여 인스턴스를 생성합니다.

Changes

파일 경로 변경 내용
src/main/.../AttendanceV2.java 새 JPA 엔티티 AttendanceV2 클래스 추가 (Primary Key, ManyToOne 관계(student, studySession), unique constraint, Builder 및 정적 팩토리 메서드 create 구현)

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant AttendanceV2
    Client->>AttendanceV2: create(student, studySession) 호출
    AttendanceV2->>AttendanceV2: Builder 패턴으로 인스턴스 생성
    AttendanceV2-->>Client: AttendanceV2 인스턴스 반환
Loading

Poem

깡총깡총 뛰노는 토끼가 외치네,
새롭게 탄생한 AttendanceV2의 멋진 빛!
학생과 스터디가 만나 춤을 추며,
정적 메서드로 탄생하는 객체의 향연,
코드 숲 속에 즐거운 변화 노래하네. 🐇🌸
"""

Tip

CodeRabbit's docstrings feature is now available as part of our Pro Plan! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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

Job Summary for Gradle

Check Style and Test to Develop :: build-test
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
gdsc check 8.5 Build Scan published

this.studySession = studySession;
}

public static AttendanceV2 of(Member student, StudySessionV2 studySession) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public static AttendanceV2 of(Member student, StudySessionV2 studySession) {
public static AttendanceV2 create(Member student, StudySessionV2 studySession) {

#804

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 (1)
src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AttendanceV2.java (1)

20-53: 전반적인 엔티티 설계에 대한 제안

전체적으로 엔티티 설계가 잘 되어 있습니다만, 출석 상태(예: 출석, 지각, 결석 등)를 나타내는 필드가 없는 것이 아쉽습니다. 향후 출석 상태를 관리할 필요가 있을 경우를 대비하여 status 필드 추가를 고려해 보세요.

@Enumerated(EnumType.STRING)
@Column(nullable = false)
private AttendanceStatus status = AttendanceStatus.PRESENT;

public enum AttendanceStatus {
    PRESENT, LATE, ABSENT
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e74d5c6 and 54ed78e.

📒 Files selected for processing (1)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AttendanceV2.java (1 hunks)
🔇 Additional comments (7)
src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AttendanceV2.java (7)

1-19: 필요한 임포트가 적절히 포함되어 있습니다.

JPA 엔티티 및 관계 정의에 필요한 모든 어노테이션과 클래스를 임포트하고 있으며, Lombok 어노테이션을 활용하여 코드를 간결하게 유지하고 있습니다.


20-26: 엔티티 정의 및 제약조건이 적절합니다.

@Table 어노테이션에서 member_idstudy_session_v2_id에 대한 복합 유니크 제약조건이 잘 정의되어 있어 한 학생이 같은 스터디 세션에 중복 출석할 수 없도록 제한하고 있습니다. 또한 BaseEntity를 상속받아 생성/수정 시간 등의 공통 필드를 활용하는 것은 좋은 설계입니다.


28-31: ID 필드 정의가 명확합니다.

기본키로 @Id@GeneratedValue를 사용하여 자동 증가 전략을 적용한 것은 적절합니다. 컬럼명도 명확하게 지정되어 있습니다.


33-35: Member 엔티티와의 관계 정의에 대한 검토가 필요합니다.

student 필드는 Member 엔티티와의 다대일 관계를 나타내고 있습니다. FetchType.LAZY를 사용한 것은 성능 최적화에 좋은 선택입니다. 하지만 필드명 student와 컬럼명 member_id 간의 일관성이 부족해 보입니다.

필드명과 컬럼명의 일관성을 유지하는 것을 고려해 보세요. 현재 필드명은 student이고 컬럼명은 member_id인데, 이 둘 사이의 불일치는 향후 혼란을 야기할 수 있습니다. 필드명을 member로 변경하거나, 아니면 컬럼명을 student_id로 변경하는 것을 검토해보세요.


37-39: StudySessionV2와의 관계 정의가 적절합니다.

studySession 필드는 StudySessionV2 엔티티와의 다대일 관계를 나타내며, 지연 로딩 전략을 사용하고 있습니다. 필드명과 컬럼명이 일관성 있게 명명되어 있습니다.


41-45: 생성자 접근 제어가 잘 설정되어 있습니다.

@Builder 어노테이션에 AccessLevel.PRIVATE을 적용하여 빌더 패턴의 생성자를 private으로 제한한 것은 객체 생성을 정적 팩토리 메서드로 통제하려는 의도를 잘 나타내고 있습니다. 이는 객체 생성의 일관성을 유지하는 좋은 방법입니다.


47-52: 정적 팩토리 메서드가 잘 구현되어 있습니다.

of 메서드를 통해 AttendanceV2 인스턴스를 생성하는 정적 팩토리 메서드 패턴이 잘 적용되어 있습니다. 이는 객체 생성에 의미를 부여하고 생성 과정을 명확하게 제어할 수 있게 해줍니다.

Copy link
Member

@uwoobeat uwoobeat left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

Job Summary for Gradle

Check Style and Test to Develop :: build-test
Gradle Root Project Requested Tasks Gradle Version Build Outcome Build Scan®
gdsc check 8.5 Build Scan published

@Sangwook02 Sangwook02 merged commit c3d3971 into develop Feb 26, 2025
1 of 2 checks passed
@Sangwook02 Sangwook02 deleted the feature/934-attendance-v2-domain branch February 26, 2025 12:39
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 (1)
src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AttendanceV2.java (1)

33-39: 관계 매핑이 적절하게 설정되었습니다.

MemberStudySessionV2에 대한 다대일(ManyToOne) 관계가 지연 로딩(LAZY)으로 설정되어 있어 성능 최적화에 도움이 됩니다.

다만, student 필드명과 member_id 컬럼명 사이에 약간의 불일치가 있습니다. 일관성을 위해 필드명을 member로 변경하거나 테이블 설계 문서에 이러한 매핑 관계를 명확히 기록해 두는 것이 좋을 수 있습니다.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54ed78e and ee7a572.

📒 Files selected for processing (1)
  • src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AttendanceV2.java (1 hunks)
🔇 Additional comments (7)
src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AttendanceV2.java (7)

1-19: 패키지 및 임포트 구조가 적절합니다.

필요한 JPA 어노테이션과 Lombok 어노테이션이 모두 잘 가져와졌으며, 코드 구성이 깔끔합니다.


20-26: 엔티티 클래스 정의가 명확합니다.

JPA 엔티티 설정이 적절하게 되어 있으며, BaseEntity를 상속받아 공통 필드를 활용하는 점이 좋습니다. 또한 @NoArgsConstructor의 접근 수준을 PROTECTED로 설정하여 무분별한 객체 생성을 방지한 것도 좋은 방식입니다.


23-24: 유니크 제약 조건이 잘 설정되었습니다.

회원(member_id)과 스터디 세션(study_session_v2_id)의 조합에 유니크 제약 조건을 설정하여 동일한 세션에 중복 출석을 방지하는 설계가 좋습니다.


28-31: 식별자 필드 설정이 적절합니다.

ID 필드에 @Id, @GeneratedValue 어노테이션으로 기본 키와 자동 증가 전략이 잘 설정되었습니다.


41-45: 생성자 접근 제어가 잘 설정되었습니다.

빌더 패턴을 사용하면서 생성자 접근 수준을 PRIVATE으로 설정하여 객체 생성을 팩토리 메서드로만 가능하게 한 점이 좋습니다.


47-52: 정적 팩토리 메서드가 잘 구현되었습니다.

create 메서드를 통해 객체 생성을 캡슐화하고 빌더 패턴을 활용하여 가독성을 높인 설계가 좋습니다.


1-53: 도메인 설계가 전체적으로 적절합니다.

전반적으로 JPA 엔티티 설계 원칙과 도메인 주도 설계(DDD) 원칙을 잘 따르고 있습니다:

  • 생성자를 private으로 설정하고 빌더 패턴을 사용하여 불변성 보장
  • 정적 팩토리 메서드를 통한 객체 생성 제어
  • 적절한 JPA 어노테이션과 관계 설정
  • 명확한 이름 지정과 구조

다만, 도메인 클래스에 대한 테스트 코드 작성을 고려해보시길 권장합니다. 특히 유니크 제약 조건이 실제로 잘 작동하는지 검증하는 통합 테스트가 있으면 좋을 것 같습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature 새로운 기능 추가 및 수정
Projects
None yet
Development

Successfully merging this pull request may close these issues.

✨ Attendance V2 도메인 구현
2 participants