Skip to content

[Feat] #180 User 엔티티 ERD 정합 - 승격 시 지원서 개인정보 필드 추가#181

Merged
seoyeon83 merged 3 commits into
mainfrom
feat/#180-user-entity-erd-fields
Jul 18, 2026
Merged

[Feat] #180 User 엔티티 ERD 정합 - 승격 시 지원서 개인정보 필드 추가#181
seoyeon83 merged 3 commits into
mainfrom
feat/#180-user-entity-erd-fields

Conversation

@seoyeon83

@seoyeon83 seoyeon83 commented Jul 18, 2026

Copy link
Copy Markdown
Member

💡 개요

🪐 주요 변경 사항

  • users 테이블 스키마를 ERD와 정합화 (승격 시 지원서 개인정보 전체 복사)
  • MilitaryStatus enum을 Applicant 내부 → global.common.enums로 이동 (Applicant/User 공용)

✅ 상세 내용

  • User 엔티티에 ERD 누락 필드 7종 추가: email, minor_double_major(JSON), last_semester, military_status, birth_date, graduation_date, grad_school_plan
  • User.promote()UserAdminService 승격 로직이 Applicant에서 7필드 전부 복사하도록 수정
  • MilitaryStatus 공용 이동에 따른 참조 6개 파일(요청/응답 DTO, 테스트) 갱신
  • UserAdminServiceTest(TC-005) / UserIntegrationTest 필드 복사 검증 확장, 전체 테스트 그린

🔔 참고 사항

  • 변경 목적: User 엔티티를 ERD와 정합화하고, 지원서 승격 시 개인정보를 사용자 정보에 모두 반영합니다. 또한 지원서 삭제 시 평가 데이터의 외래 키 오류를 방지합니다.

  • 주요 변경 내용:

    • User 엔티티에 이메일, 부전공, 마지막 학기, 군복무 상태, 생년월일, 졸업일, 대학원 진학 계획 필드 추가
    • User.promote() 및 승격 서비스에서 Applicant의 개인정보 전체 복사
    • MilitaryStatus를 공용 enum으로 이동하고 관련 DTO·엔티티·테스트 참조 변경
    • 지원서 삭제 전 ApplicantEval을 먼저 삭제하도록 로직 및 리포지토리 추가
    • 승격 필드 복사와 평가 데이터 삭제에 대한 단위·통합 테스트 보강
  • 영향 범위:

    • API 변경: militaryStatus 타입이 Applicant.MilitaryStatus에서 공용 MilitaryStatus로 변경
    • DB 스키마 변경: users 테이블에 신규 컬럼 7종 추가 필요
    • 설정 변경: 없음

seoyeon83 and others added 3 commits July 8, 2026 15:36
평가 어드민 기능(#170) 추가 후 applicant_eval.applicant_id NOT NULL FK가
생겼으나 deleteApplicants가 이를 정리하지 않아, 평가가 존재하는 공고는
지원서 전체 삭제가 FK 제약 위반으로 실패하던 문제를 수정.

- ApplicantEvalRepository.deleteByRecruitmentId 서브쿼리 벌크 삭제 추가
- deleteApplicants 삭제 순서를 eval -> answer -> applicant 로 정정
- 단위/리포지토리/통합 테스트에 평가 존재 케이스 회귀 테스트 추가
…eval

[Fix] 지원서 전체 삭제 시 평가(applicant_eval) 미삭제로 인한 FK 위반 수정
- User에 email, minor_double_major, last_semester, military_status,
  birth_date, graduation_date, grad_school_plan 필드 추가
- MilitaryStatus enum을 global.common.enums로 이동 (Applicant/User 공용)
- User.promote() 및 UserAdminService 승격 로직에 신규 필드 복사 반영
- UserAdminServiceTest / UserIntegrationTest 필드 복사 검증 확장
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

공용 MilitaryStatus enum을 도입해 지원자 관련 타입을 통일하고, 공고 삭제 시 평가 데이터를 먼저 제거하도록 변경했습니다. 또한 사용자 승격 과정에서 이메일·학업·군복무·생년월일 등의 지원자 정보를 User에 저장하고 테스트 검증을 확장했습니다.

Changes

지원자 및 사용자 데이터 흐름

Layer / File(s) Summary
공용 군복무 상태 모델 전환
src/main/java/com/boaz/backend/global/common/enums/MilitaryStatus.java, src/main/java/com/boaz/backend/domain/recruitment/entity/Applicant.java, src/main/java/com/boaz/backend/domain/recruitment/dto/...
공용 MilitaryStatus enum을 추가하고 Applicant 및 지원서 요청·응답 DTO의 군복무 상태 타입을 통일했습니다.
지원자 평가 선행 삭제
src/main/java/com/boaz/backend/domain/recruitment/repository/ApplicantEvalRepository.java, src/main/java/com/boaz/backend/domain/recruitment/service/RecruitmentService.java, src/test/java/com/boaz/backend/domain/recruitment/...
공고별 평가 일괄 삭제 메서드를 추가하고, 삭제 순서를 평가·답변·지원자로 변경했으며 관련 단위·통합 테스트를 확장했습니다.
승격 프로필 필드 확장
src/main/java/com/boaz/backend/domain/user/entity/User.java, src/main/java/com/boaz/backend/domain/user/service/UserAdminService.java, src/test/java/com/boaz/backend/domain/user/...
User에 이메일, 학업, 군복무, 날짜 및 대학원 계획 필드를 추가하고 Applicant의 해당 정보를 승격 시 저장하도록 변경했습니다.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.53% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed User 엔티티 정합화와 승격 시 지원서 개인정보 복사라는 핵심 변경을 잘 요약하고 있습니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/#180-user-entity-erd-fields

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.

@seoyeon83 seoyeon83 self-assigned this Jul 18, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
src/main/java/com/boaz/backend/domain/recruitment/repository/ApplicantEvalRepository.java (1)

45-47: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

벌크 연산 후 영속성 컨텍스트 동기화를 고려해보면 어떨까요?

@Modifying 어노테이션에 flushAutomatically = true, clearAutomatically = true 속성을 추가하는 것을 추천드려요! 벌크 삭제 쿼리가 실행된 후 영속성 컨텍스트를 비워주면, 이후 동일한 트랜잭션 내에서 남아있는 캐시로 인한 예기치 못한 데이터 불일치를 예방할 수 있답니다. 파일 상단의 upsert 메서드와 일관성을 맞출 수도 있어 더욱 좋을 것 같아요!

✨ 이렇게 수정해보시는 건 어떨까요?
-    `@Modifying`
+    `@Modifying`(flushAutomatically = true, clearAutomatically = true)
     `@Query`("DELETE FROM ApplicantEval e WHERE e.applicant.id IN (SELECT a.id FROM Applicant a WHERE a.recruitment.id = :recruitmentId)")
     void deleteByRecruitmentId(`@Param`("recruitmentId") Long recruitmentId);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/com/boaz/backend/domain/recruitment/repository/ApplicantEvalRepository.java`
around lines 45 - 47, Update the `@Modifying` annotation on deleteByRecruitmentId
to enable flushAutomatically and clearAutomatically, ensuring pending changes
are flushed before the bulk delete and the persistence context is cleared
afterward. Keep the existing delete query and method signature unchanged.
src/test/java/com/boaz/backend/domain/recruitment/integration/RecruitmentIntegrationTest.java (1)

685-691: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

FQCN(Full Qualified Class Name) 대신 import를 활용해보면 어떨까요?

현재 Admin 엔티티와 관련된 클래스명들이 패키지명까지 모두 포함되어 있어 코드가 조금 길어졌어요. 파일 상단에 import com.boaz.backend.domain.admin.entity.Admin;을 추가해 주시면 코드가 한결 간결하고 읽기 편해질 것 같아요! (만약 동음이의어 클래스 충돌이 있다면 지금처럼 명시적으로 쓰시는 것도 훌륭한 선택입니다 😊)

✨ 이렇게 수정해보시는 건 어떨까요?
-            com.boaz.backend.domain.admin.entity.Admin evaluator = adminRepository.save(
-                    com.boaz.backend.domain.admin.entity.Admin.builder()
+            Admin evaluator = adminRepository.save(
+                    Admin.builder()
                     .username("evaluator-178").password("p")
-                    .role(com.boaz.backend.domain.admin.entity.Admin.Role.TEAM).name("평가자")
+                    .role(Admin.Role.TEAM).name("평가자")
                     .track(Track.ENGINEERING).term(26)
-                    .teamName(com.boaz.backend.domain.admin.entity.Admin.TeamName.서비스운영팀)
+                    .teamName(Admin.TeamName.서비스운영팀)
                     .createdBy(null).build());
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/test/java/com/boaz/backend/domain/recruitment/integration/RecruitmentIntegrationTest.java`
around lines 685 - 691, Replace the fully qualified Admin references in the
evaluator setup with the imported Admin class, adding the Admin import at the
file top; retain fully qualified names only if an actual class-name collision
exists.
src/main/java/com/boaz/backend/domain/user/entity/User.java (1)

86-104: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

파라미터 객체 도입을 고려해 보세요.

승격 시 전달해야 할 파라미터가 많이 늘어났네요! 도메인(User)이 다른 도메인(Applicant)에 직접 의존하지 않도록 필드를 풀어서 전달하는 현재의 방식도 의도가 명확해서 좋습니다.

다만 메서드의 파라미터 개수가 10개가 넘어가면 호출부에서 순서를 헷갈리기 쉬우니, 나중에 기회가 된다면 UserPromotionDto와 같은 전용 파라미터 객체(Record 등)를 도입해서 응집도를 높여보는 것도 좋은 개선 방향이 될 것 같아요! ✨

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/com/boaz/backend/domain/user/entity/User.java` around lines 86
- 104, Consider introducing a dedicated promotion parameter object, such as
UserPromotionDto or a record, for User.promote instead of passing the many
individual promotion fields. Update promote and its call sites to consume the
object while keeping User independent of Applicant by defining the object with
only the required promotion values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@src/main/java/com/boaz/backend/domain/recruitment/repository/ApplicantEvalRepository.java`:
- Around line 45-47: Update the `@Modifying` annotation on deleteByRecruitmentId
to enable flushAutomatically and clearAutomatically, ensuring pending changes
are flushed before the bulk delete and the persistence context is cleared
afterward. Keep the existing delete query and method signature unchanged.

In `@src/main/java/com/boaz/backend/domain/user/entity/User.java`:
- Around line 86-104: Consider introducing a dedicated promotion parameter
object, such as UserPromotionDto or a record, for User.promote instead of
passing the many individual promotion fields. Update promote and its call sites
to consume the object while keeping User independent of Applicant by defining
the object with only the required promotion values.

In
`@src/test/java/com/boaz/backend/domain/recruitment/integration/RecruitmentIntegrationTest.java`:
- Around line 685-691: Replace the fully qualified Admin references in the
evaluator setup with the imported Admin class, adding the Admin import at the
file top; retain fully qualified names only if an actual class-name collision
exists.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e6db8623-0e72-4787-84d0-91960c01e9e0

📥 Commits

Reviewing files that changed from the base of the PR and between a3e20f3 and e362117.

📒 Files selected for processing (16)
  • src/main/java/com/boaz/backend/domain/recruitment/dto/request/ApplicationRequest.java
  • src/main/java/com/boaz/backend/domain/recruitment/dto/request/DraftApplicationRequest.java
  • src/main/java/com/boaz/backend/domain/recruitment/dto/response/ApplicantEvaluationResponse.java
  • src/main/java/com/boaz/backend/domain/recruitment/dto/response/ApplicantSummaryResponse.java
  • src/main/java/com/boaz/backend/domain/recruitment/dto/response/MyApplicationResponse.java
  • src/main/java/com/boaz/backend/domain/recruitment/entity/Applicant.java
  • src/main/java/com/boaz/backend/domain/recruitment/repository/ApplicantEvalRepository.java
  • src/main/java/com/boaz/backend/domain/recruitment/service/RecruitmentService.java
  • src/main/java/com/boaz/backend/domain/user/entity/User.java
  • src/main/java/com/boaz/backend/domain/user/service/UserAdminService.java
  • src/main/java/com/boaz/backend/global/common/enums/MilitaryStatus.java
  • src/test/java/com/boaz/backend/domain/recruitment/integration/RecruitmentIntegrationTest.java
  • src/test/java/com/boaz/backend/domain/recruitment/repository/ApplicantEvalRepositoryTest.java
  • src/test/java/com/boaz/backend/domain/recruitment/service/RecruitmentServiceTest.java
  • src/test/java/com/boaz/backend/domain/user/integration/UserIntegrationTest.java
  • src/test/java/com/boaz/backend/domain/user/service/UserAdminServiceTest.java

@seoyeon83
seoyeon83 merged commit c564394 into main Jul 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants