feat/KD-43 Thesis, Certificate 도메인 엔티티 모델 물리 모델링#275
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughCertificate과 Thesis 도메인을 위해 도메인 엔티티 클래스 2개와 JPA 엔티티 클래스 2개를 추가하는 변경사항. 각 도메인 클래스는 Lombok Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related issues
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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 |
Test Coverage Report
Files
|
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (10.00%). You can increase the patch coverage or adjust the target coverage. @@ Coverage Diff @@
## develop #275 +/- ##
=============================================
- Coverage 83.70% 81.00% -2.71%
Complexity 164 164
=============================================
Files 55 57 +2
Lines 540 558 +18
Branches 5 5
=============================================
Hits 452 452
- Misses 82 100 +18
Partials 6 6
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (6)
aics-domain/src/main/java/kgu/developers/domain/thesis/domain/Thesis.java (2)
7-15: 도메인 객체의 불변성을 보장하기 위해 필드를final로 선언하는 것을 권장합니다.현재 필드들이
final이 아니어서 객체 생성 후에도 값이 변경될 수 있습니다. 도메인 객체는 일반적으로 불변 객체로 설계하여 안전성을 보장합니다.다음과 같이 필드를
final로 변경하는 것을 고려하세요:@Getter public class Thesis { - private Long id; - private Long scheduleId; - private Long thesisFileId; - private boolean approval; - private LocalDateTime createdAt; - private LocalDateTime updatedAt; - private LocalDateTime deletedAt; + private final Long id; + private final Long scheduleId; + private final Long thesisFileId; + private final boolean approval; + private final LocalDateTime createdAt; + private final LocalDateTime updatedAt; + private final LocalDateTime deletedAt;
17-34: 팩토리 메서드에서 입력 값에 대한 검증을 추가하는 것을 고려하세요.현재
null값이나 유효하지 않은 값에 대한 검증이 없어 잘못된 도메인 객체가 생성될 수 있습니다. 비즈니스 규칙에 따라 필수 필드(예:scheduleId,thesisFileId)에 대한 검증을 추가하면 도메인 무결성을 보장할 수 있습니다.aics-domain/src/main/java/kgu/developers/domain/certificate/domain/Certificate.java (3)
7-15: 도메인 객체의 불변성을 보장하기 위해 필드를final로 선언하는 것을 권장합니다.현재 필드들이
final이 아니어서 객체 생성 후에도 값이 변경될 수 있습니다. 도메인 객체는 일반적으로 불변 객체로 설계하여 안전성을 보장합니다. (이 이슈는Thesis.java에서도 동일하게 발견되었습니다.)
17-34: 팩토리 메서드에서 입력 값에 대한 검증을 추가하는 것을 고려하세요.현재
null값이나 유효하지 않은 값에 대한 검증이 없어 잘못된 도메인 객체가 생성될 수 있습니다. 비즈니스 규칙에 따라 필수 필드(예:scheduleId,certificateFileId)에 대한 검증을 추가하면 도메인 무결성을 보장할 수 있습니다.
7-34: 코드 중복:Thesis와Certificate도메인 클래스의 구조가 동일합니다.두 클래스가 필드명(
thesisFileIdvscertificateFileId)을 제외하고 거의 동일한 구조를 가지고 있습니다. 향후 유지보수성을 위해 공통 베이스 클래스나 제네릭을 활용한 추상화를 고려할 수 있지만, 도메인의 독립성을 유지하는 것도 중요하므로 현재 구조를 유지하는 것도 타당합니다.이 부분은 팀의 아키텍처 방향성에 따라 결정하시면 됩니다.
aics-domain/src/main/java/kgu/developers/domain/certificate/infrastructure/entity/CertificateJpaEntity.java (1)
19-65: 코드 중복:ThesisJpaEntity와CertificateJpaEntity의 구조가 동일합니다.두 JPA 엔티티 클래스가 필드명(
thesisFileIdvscertificateFileId)과 테이블명을 제외하고 거의 동일한 구조를 가지고 있습니다. 향후 유지보수 시 변경사항을 두 곳에 모두 적용해야 하는 번거로움이 있을 수 있습니다.그러나 도메인의 독립성과 명확성을 유지하는 것도 중요하므로, 현재 구조를 유지하는 것도 타당한 선택입니다. 이 부분은 팀의 아키텍처 방향성에 따라 결정하시면 됩니다.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
aics-domain/src/main/java/kgu/developers/domain/certificate/domain/Certificate.java(1 hunks)aics-domain/src/main/java/kgu/developers/domain/certificate/infrastructure/entity/CertificateJpaEntity.java(1 hunks)aics-domain/src/main/java/kgu/developers/domain/thesis/domain/Thesis.java(1 hunks)aics-domain/src/main/java/kgu/developers/domain/thesis/infrastructure/entity/ThesisJpaEntity.java(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
aics-domain/src/main/java/kgu/developers/domain/thesis/infrastructure/entity/ThesisJpaEntity.java (1)
aics-domain/src/main/java/kgu/developers/domain/certificate/infrastructure/entity/CertificateJpaEntity.java (1)
Builder(19-66)
aics-domain/src/main/java/kgu/developers/domain/certificate/infrastructure/entity/CertificateJpaEntity.java (1)
aics-domain/src/main/java/kgu/developers/domain/thesis/infrastructure/entity/ThesisJpaEntity.java (1)
Builder(19-66)
🔇 Additional comments (6)
aics-domain/src/main/java/kgu/developers/domain/thesis/infrastructure/entity/ThesisJpaEntity.java (3)
19-27: LGTM! Lombok 어노테이션과 접근 제어자가 적절하게 구성되었습니다.
@NoArgsConstructor(access = PROTECTED)와@AllArgsConstructor(access = PRIVATE)를 사용하여 JPA 요구사항을 충족하면서도 불필요한 외부 접근을 차단하고 있습니다.
21-25: 인덱스 추가가 적절합니다.
schedule_id에 대한 인덱스를 추가하여 조회 성능을 향상시켰습니다. PR 설명에서 언급한 대로scheduleId에@JoinColumn이나 외래 키를 설정하지 않아 도메인 간 강한 결합을 피하면서도 성능은 확보한 설계입니다.
42-49: 타임스탬프 필드 처리 방식을 검토하세요.
toEntity()메서드가 도메인 객체의createdAt,updatedAt,deletedAt값을 엔티티로 복사하지 않습니다.BaseTimeEntity가 이러한 필드를 자동으로 관리하지만, 기존 도메인 객체를 엔티티로 변환할 때 타임스탬프를 보존해야 하는 경우(예: 업데이트 작업)에는 문제가 될 수 있습니다.새로운 엔티티 생성 시에만
toEntity()를 사용하는지 확인하고, 기존 엔티티 업데이트 시나리오도 고려하세요.aics-domain/src/main/java/kgu/developers/domain/certificate/infrastructure/entity/CertificateJpaEntity.java (3)
19-27: LGTM! Lombok 어노테이션과 접근 제어자가 적절하게 구성되었습니다.
@NoArgsConstructor(access = PROTECTED)와@AllArgsConstructor(access = PRIVATE)를 사용하여 JPA 요구사항을 충족하면서도 불필요한 외부 접근을 차단하고 있습니다.
21-25: 인덱스 추가가 적절합니다.
schedule_id에 대한 인덱스를 추가하여 조회 성능을 향상시켰습니다. PR 설명에서 언급한 대로scheduleId에@JoinColumn이나 외래 키를 설정하지 않아 도메인 간 강한 결합을 피하면서도 성능은 확보한 설계입니다.
42-49: 타임스탬프 필드 처리 방식을 검토하세요.
toEntity()메서드가 도메인 객체의createdAt,updatedAt,deletedAt값을 엔티티로 복사하지 않습니다.BaseTimeEntity가 이러한 필드를 자동으로 관리하지만, 기존 도메인 객체를 엔티티로 변환할 때 타임스탬프를 보존해야 하는 경우(예: 업데이트 작업)에는 문제가 될 수 있습니다.새로운 엔티티 생성 시에만
toEntity()를 사용하는지 확인하고, 기존 엔티티 업데이트 시나리오도 고려하세요.
JangYeongHu
left a comment
There was a problem hiding this comment.
LGTM~ 👍👍
따로 수정할만한 부분은 없는 것 같네요
수고하셨습니다
Summary
Thesis, Certificate 도메인 모델과 엔티티 모델을 구현합니다.
Tasks
To Reviewer
도메인 간 강한 결합도를 제거하기 위해 scheduleId에 JoinColumn과 외래키를 걸지 않았고
다만 성능 향상을 위해 인덱스를 추가하였습니다.
Screenshot
(없을 경우 삭제) 작업한 내용에 대한 스크린샷을 첨부해주세요.