-
Notifications
You must be signed in to change notification settings - Fork 1
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
Conversation
📝 Walkthrough""" Walkthrough새로운 JPA 엔티티 클래스인 Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant AttendanceV2
Client->>AttendanceV2: create(student, studySession) 호출
AttendanceV2->>AttendanceV2: Builder 패턴으로 인스턴스 생성
AttendanceV2-->>Client: AttendanceV2 인스턴스 반환
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Pro Plan! Simply use the command ✨ Finishing Touches
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
this.studySession = studySession; | ||
} | ||
|
||
public static AttendanceV2 of(Member student, StudySessionV2 studySession) { |
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.
public static AttendanceV2 of(Member student, StudySessionV2 studySession) { | |
public static AttendanceV2 create(Member student, StudySessionV2 studySession) { |
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 (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
📒 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_id
와study_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
인스턴스를 생성하는 정적 팩토리 메서드 패턴이 잘 적용되어 있습니다. 이는 객체 생성에 의미를 부여하고 생성 과정을 명확하게 제어할 수 있게 해줍니다.
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.
lgtm
Job Summary for GradleCheck Style and Test to Develop :: build-test
|
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 (1)
src/main/java/com/gdschongik/gdsc/domain/studyv2/domain/AttendanceV2.java (1)
33-39
: 관계 매핑이 적절하게 설정되었습니다.
Member
와StudySessionV2
에 대한 다대일(ManyToOne) 관계가 지연 로딩(LAZY)으로 설정되어 있어 성능 최적화에 도움이 됩니다.다만,
student
필드명과member_id
컬럼명 사이에 약간의 불일치가 있습니다. 일관성을 위해 필드명을member
로 변경하거나 테이블 설계 문서에 이러한 매핑 관계를 명확히 기록해 두는 것이 좋을 수 있습니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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 어노테이션과 관계 설정
- 명확한 이름 지정과 구조
다만, 도메인 클래스에 대한 테스트 코드 작성을 고려해보시길 권장합니다. 특히 유니크 제약 조건이 실제로 잘 작동하는지 검증하는 통합 테스트가 있으면 좋을 것 같습니다.
🌱 관련 이슈
📌 작업 내용 및 특이사항
📝 참고사항
📚 기타
Summary by CodeRabbit