Skip to content

feat: GraduationUser의 도메인, 엔티티 모델링#279

Merged
JangYeongHu merged 5 commits intodevelopfrom
feature/KD-39
Nov 10, 2025
Merged

feat: GraduationUser의 도메인, 엔티티 모델링#279
JangYeongHu merged 5 commits intodevelopfrom
feature/KD-39

Conversation

@JangYeongHu
Copy link
Copy Markdown
Contributor

Summary

해당 PR에 대한 요약을 작성해주세요.

Tasks

  • GraduationUser의 도메인 엔티티 모델을 모델링 하였습니다.

To Reviewer

Screenshot

@JangYeongHu JangYeongHu self-assigned this Nov 7, 2025
@JangYeongHu JangYeongHu added the ✨feature create new feature label Nov 7, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 7, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

졸업생 관리 도메인 모델링 작업으로, GraduationType 열거형, GraduationUser 도메인 엔티티, 그리고 GraduationUserJpaEntity JPA 영속성 엔티티를 추가합니다. 각각 필요한 필드와 Lombok 기반의 접근자/빌더, 그리고 엔티티-도메인 간 매핑 헬퍼 메서드를 포함합니다.

Changes

Cohort / File(s) Summary
GraduationType 열거형
aics-domain/src/main/java/kgu/developers/domain/graduationUser/domain/GraduationType.java
THESIS("논문"), CERTIFICATE("자격증") 두 개의 상수를 가진 공개 열거형 추가. Lombok @Getter, @RequiredArgsConstructor로 description 필드 접근 및 생성자 생성
GraduationUser 도메인 엔티티
aics-domain/src/main/java/kgu/developers/domain/graduationUser/domain/GraduationUser.java
공개 도메인 클래스 추가. id, name, email, advisorProfessor, graduationType, graduationDate, midThesisId, finalThesisId, certificateId, userId 공개 필드와 createdAt, updatedAt, deletedAt 보호 필드 포함. Lombok @Getter, @Builder 적용
GraduationUserJpaEntity 영속성 엔티티
aics-domain/src/main/java/kgu/developers/domain/graduationUser/infrastructure/entity/GraduationUserJpaEntity.java
JPA 매핑 엔티티 추가. @Entity, @Table, @Id, @GeneratedValue, @Column, @Enumerated 등 JPA 어노테이션 적용. Lombok @Getter, @Builder, @NoArgsConstructor, @AllArgsConstructor 추가. BaseTimeEntity 상속. toEntity(GraduationUser), toDomain(GraduationUserJpaEntity) 정적 매핑 헬퍼 메서드 제공

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • 새로운 도메인 모델 구조 적절성 검증 필요 (GraduationType 열거형의 비즈니스 의도, 필드 설계)
  • 엔티티-도메인 매핑 로직 검토 (toEntity, toDomain 메서드의 null 처리 및 필드 변환 정확성)
  • JPA 어노테이션 설정 검증 (테이블명, 컬럼 타입, 기본키 생성 전략)

Possibly related issues

  • GraduationUser 도메인, 엔티티 모델링 #278: GraduationUser 도메인, 엔티티 모델링 작업을 직접 구현하며, 새롭게 추가된 GraduationType 열거형, GraduationUser 도메인 엔티티, GraduationUserJpaEntity 기반 구조와 정확히 부합합니다.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: domain and entity modeling of GraduationUser. It accurately reflects the three files added (GraduationType enum, GraduationUser domain class, and GraduationUserJpaEntity).
Description check ✅ Passed The description references issue #278 and mentions the main task of modeling GraduationUser domain entities, which aligns with the changeset. Though brief, it is directly related to the PR's purpose.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 7, 2025

Test Coverage Report

Overall Project 94.2% -0.92% 🍏
Files changed 0%

Module Coverage
aics-domain 91.3% -1.39%
Files
Module File Coverage
aics-domain GraduationType.java 0%

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 7, 2025

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...s/domain/graduationUser/domain/GraduationType.java 0.00% 3 Missing ⚠️

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

Impacted file tree graph

@@              Coverage Diff              @@
##             develop     #279      +/-   ##
=============================================
- Coverage      93.38%   92.81%   -0.58%     
  Complexity       164      164              
=============================================
  Files             49       50       +1     
  Lines            484      487       +3     
  Branches           4        4              
=============================================
  Hits             452      452              
- Misses            26       29       +3     
  Partials           6        6              
Files with missing lines Coverage Δ Complexity Δ
...s/domain/graduationUser/domain/GraduationType.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 374c7c0...9955886. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

@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: 1

🧹 Nitpick comments (2)
aics-domain/src/main/java/kgu/developers/domain/graduationUser/domain/GraduationUser.java (2)

23-25: 타임스탬프 필드의 가시성을 private로 변경하는 것을 권장합니다.

도메인 모델에서 protected 가시성은 일반적으로 상속 구조가 있을 때 사용됩니다. 현재 GraduationUser는 상속을 위한 클래스가 아니므로, 더 나은 캡슐화를 위해 private으로 변경하는 것이 좋습니다.

-    protected LocalDateTime createdAt;
-    protected LocalDateTime updatedAt;
-    protected LocalDateTime deletedAt;
+    private LocalDateTime createdAt;
+    private LocalDateTime updatedAt;
+    private LocalDateTime deletedAt;

9-26: 빌더 패턴에 필수 필드 검증을 추가하는 것을 고려하세요.

현재 빌더는 검증 없이 모든 필드를 null로 생성할 수 있습니다. 비즈니스 규칙상 필수인 필드(예: name, email, advisorProfessor, graduationType)에 대해 커스텀 빌더를 통한 검증을 추가하면 도메인 무결성을 향상시킬 수 있습니다.

예시:

@Getter
@Builder
public class GraduationUser {
    // ... fields ...
    
    public static class GraduationUserBuilder {
        public GraduationUser build() {
            if (name == null || name.isBlank()) {
                throw new IllegalArgumentException("이름은 필수입니다.");
            }
            if (email == null || email.isBlank()) {
                throw new IllegalArgumentException("이메일은 필수입니다.");
            }
            // 추가 검증...
            return new GraduationUser(/* ... */);
        }
    }
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 374c7c0 and 1abb7cf.

📒 Files selected for processing (3)
  • aics-domain/src/main/java/kgu/developers/domain/graduationUser/domain/GraduationType.java (1 hunks)
  • aics-domain/src/main/java/kgu/developers/domain/graduationUser/domain/GraduationUser.java (1 hunks)
  • aics-domain/src/main/java/kgu/developers/domain/graduationUser/infrastructure/entity/GraduationUserJpaEntity.java (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
aics-domain/src/main/java/kgu/developers/domain/graduationUser/infrastructure/entity/GraduationUserJpaEntity.java (1)
aics-domain/src/main/java/kgu/developers/domain/graduationUser/domain/GraduationUser.java (1)
  • Getter (9-26)
aics-domain/src/main/java/kgu/developers/domain/graduationUser/domain/GraduationType.java (1)
aics-domain/src/main/java/kgu/developers/domain/graduationUser/domain/GraduationUser.java (1)
  • Getter (9-26)
🔇 Additional comments (3)
aics-domain/src/main/java/kgu/developers/domain/graduationUser/domain/GraduationType.java (1)

6-14: 잘 구현된 열거형입니다.

졸업 유형을 나타내는 열거형이 명확하게 정의되어 있으며, Lombok을 활용한 구현도 적절합니다.

aics-domain/src/main/java/kgu/developers/domain/graduationUser/infrastructure/entity/GraduationUserJpaEntity.java (2)

36-57: 필드 제약 조건과 관계 명세를 검증하세요.

다음 사항들을 확인해 주세요:

  • userId (라인 57): 다른 String 필드와 달리 길이 제약이 없습니다. 어떤 사용자를 참조하는지, 외래키 관계가 필요한지 확인이 필요합니다.
  • midThesisId, finalThesisId, certificateId (라인 51-55): 다른 엔티티와의 관계가 명확하지 않습니다. 외래키 제약이나 @ManyToOne 관계 매핑이 필요한지 검토해 주세요.
  • 각 String 필드의 길이 제약(10, 50, 20)이 실제 비즈니스 요구사항에 부합하는지 확인해 주세요.

59-76: 타임스탬프 필드 매핑의 일관성을 확인하세요.

toEntity() 메서드는 createdAt, updatedAt, deletedAt 필드를 매핑하지 않는 반면, toDomain() 메서드(라인 94-96)는 이 필드들을 명시적으로 매핑합니다.

BaseTimeEntity가 JPA 라이프사이클 콜백으로 자동 관리한다면 현재 구현이 맞지만, 만약 도메인 객체에서 엔티티로 변환 시 타임스탬프 보존이 필요한 경우(예: 업데이트 작업)에는 이 필드들도 매핑해야 합니다.

업데이트 시나리오에서 타임스탬프 보존이 필요하다면 다음과 같이 수정을 고려하세요:

public static GraduationUserJpaEntity toEntity(GraduationUser graduationUser) {
    if(graduationUser == null) {
        return null;
    }

    GraduationUserJpaEntity entity = GraduationUserJpaEntity.builder()
        .id(graduationUser.getId())
        .name(graduationUser.getName())
        .email(graduationUser.getEmail())
        .advisorProfessor(graduationUser.getAdvisorProfessor())
        .graduationType(graduationUser.getGraduationType())
        .graduationDate(graduationUser.getGraduationDate())
        .midThesisId(graduationUser.getMidThesisId())
        .finalThesisId(graduationUser.getFinalThesisId())
        .certificateId(graduationUser.getCertificateId())
        .userId(graduationUser.getUserId())
        .build();
    
    // BaseTimeEntity의 protected 필드에 직접 설정이 필요한 경우
    // 또는 별도의 setter 메서드 제공 필요
    
    return entity;
}

Copy link
Copy Markdown
Contributor

@dkdltm221 dkdltm221 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
Copy Markdown
Member

@LeeHanEum LeeHanEum 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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

이상없는거 같습니다! 고생하셨어요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨feature create new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants