Skip to content

[Fix] 지원서 전체 삭제 시 평가(applicant_eval) 미삭제로 인한 FK 위반 수정#179

Merged
seoyeon83 merged 1 commit into
devfrom
fix/#178-delete-applicants-eval
Jul 8, 2026
Merged

[Fix] 지원서 전체 삭제 시 평가(applicant_eval) 미삭제로 인한 FK 위반 수정#179
seoyeon83 merged 1 commit into
devfrom
fix/#178-delete-applicants-eval

Conversation

@seoyeon83

Copy link
Copy Markdown
Member

💡 개요

🪐 주요 변경 사항

  • 리크루팅 어드민 지원서 전체 삭제(deleteApplicants)가 applicant_eval을 정리하지 않아, 평가가 존재하는 공고 삭제 시 FK 제약 위반으로 실패하던 버그 수정
  • 삭제 순서를 FK 자식부터(applicant_eval → applicant_answer → applicant)로 정정

✅ 상세 내용

  • ApplicantEvalRepository: deleteByRecruitmentId 서브쿼리 벌크 삭제 메서드 추가 (기존 ApplicantAnswerRepository와 동일 패턴, 메모리 적재 없이 삭제)
  • RecruitmentService.deleteApplicants: 기존 answer → applicant 순서 앞에 applicant_eval 삭제를 추가하여 eval → answer → applicant 순서로 정정
  • 배경: 평가 어드민 기능([Feat] 지원서 평가 어드민 기능 구현 (지원자/평가 대시보드 + 개인·최종 평가) #170) 추가로 applicant_eval.applicant_id(NOT NULL FK, ON DELETE CASCADE 없음)가 생겼으나 삭제 로직이 미반영된 상태였음
  • 테스트 보강
    • RecruitmentServiceTest: ApplicantEvalRepository mock 추가, 삭제 순서 검증을 eval → answer → applicant 로 갱신
    • ApplicantEvalRepositoryTest: deleteByRecruitmentId — 대상 공고 평가만 삭제하고 타 공고 평가는 유지하는지 검증
    • RecruitmentIntegrationTest: end-to-end 삭제 테스트에 평가 데이터를 추가하여 평가 존재 공고도 FK 위반 없이 삭제되는지 실제 DB로 검증 (회귀 방지)

🔔 참고 사항

  • 전체 테스트 스위트 통과 확인 (./gradlew test, Testcontainers/Docker 기동 상태)
  • 다른 삭제 경로는 동일 이슈 없음: 공고/질문 삭제는 자식 존재 시 guard로 거부, 관리자 삭제는 soft delete
  • 테스트 명세서(docs/test/TC-REC-ADMIN-010.md)도 함께 갱신 (해당 경로는 gitignore 대상이라 커밋에는 미포함)

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

- ApplicantEvalRepository.deleteByRecruitmentId 서브쿼리 벌크 삭제 추가
- deleteApplicants 삭제 순서를 eval -> answer -> applicant 로 정정
- 단위/리포지토리/통합 테스트에 평가 존재 케이스 회귀 테스트 추가
@seoyeon83 seoyeon83 self-assigned this Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

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.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: aff6a242-e025-44e9-98fa-69b7966844e8

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

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/#178-delete-applicants-eval

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 merged commit 80f8734 into dev Jul 8, 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.

1 participant