Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public ResponseEntity<?> getApplyInfo(@PathVariable String clubId,

@PutMapping("/apply/{appId}")
@Operation(summary = "지원서 변경",
description = "클럽 자원자의 지원서 정보를 수정합니다.<br>"
description = "클럽 지원자의 지원서 정보를 수정합니다.<br>"
+ "appId - 지원서 아이디"
)
@PreAuthorize("isAuthenticated()")
Expand All @@ -87,7 +87,7 @@ public ResponseEntity<?> editApplicantDetail(@PathVariable String clubId,

@DeleteMapping("/apply/{appId}")
@Operation(summary = "지원서 삭제",
description = "클럽 자원자의 지원서를 삭제합니다.<br>"
description = "클럽 지원자의 지원서를 삭제합니다.<br>"
+ "appId - 지원서 아이디"
)
@PreAuthorize("isAuthenticated()")
Expand Down
13 changes: 2 additions & 11 deletions backend/src/main/java/moadong/club/enums/ApplicationStatus.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
package moadong.club.enums;

public enum ApplicationStatus {
DRAFT, // 작성 중
SUBMITTED, // 제출 완료
SCREENING, // 서류 심사 중
SCREENING_PASSED, // 서류 통과
SCREENING_FAILED, // 서류 탈락
INTERVIEW_SCHEDULED, // 면접 일정 확정
INTERVIEW_IN_PROGRESS, // 면접 진행 중
INTERVIEW_PASSED, // 면접 통과
INTERVIEW_FAILED, // 면접 탈락
OFFERED, // 최종 합격 제안
ACCEPTED, // 제안 수락
DECLINED, // 제안 거절
CANCELED_BY_APPLICANT // 지원자 자진 철회
ACCEPTED, // 합격
DECLINED, // 불합
}
Comment on lines 3 to 8
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

중요: enum 값 대폭 제거로 인한 데이터/호환성 리스크 점검 필요

이 PR에서 여러 상태값을 제거했습니다. 만약 DB에 ApplicationStatus가 저장되고 있고(특히 EnumType.ORDINAL 사용 시) 이미 저장된 레코드가 제거된 값들을 포함한다면,

  • EnumType.STRING: 제거된 문자열이 역직렬화 시 매칭 실패 → 예외 발생 가능
  • EnumType.ORDINAL: enum 순서 변경으로 다른 값으로 잘못 매핑 → 데이터 오염

또한 외부/프론트엔드에서 제거된 상태 문자열로 요청 시 역직렬화 400이 발생할 수 있습니다. 배포 전 마이그레이션/하위호환 전략이 필요합니다.

[offer_assistance]
권장 조치:

  • 우선 점검
    • ClubApplication.status 필드의 @Enumerated 전략 확인 (ORDINAL 사용 시 즉시 교체 권장)
    • 코드 전역에서 제거된 상수 사용처가 남아있는지 확인
  • 전환 전략(택1 또는 병행)
    • 단기: AttributeConverter로 레거시 문자열을 신규 상태로 매핑하여 읽기 호환 보장
    • 단기: 제거한 상수를 @deprecated로 일시 복원(생성/전이 로직에서는 미사용), 이후 DB 마이그레이션 후 완전 제거
    • 영구: Flyway/Liquibase 등으로 DB 내 문자열을 신규 상태로 업데이트

다음 스크립트로 영향도를 빠르게 점검할 수 있습니다:

원하시면 AttributeConverter 템플릿(레거시 → 신규 매핑) 초안도 제공하겠습니다.


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== 제거된 상태값 사용 검색 =="
rg -nP -C2 '\b(DRAFT|SCREENING|SCREENING_PASSED|SCREENING_FAILED|INTERVIEW_IN_PROGRESS|INTERVIEW_PASSED|INTERVIEW_FAILED|OFFERED|CANCELED_BY_APPLICANT)\b'

echo
echo "== ClubApplication 엔티티에서 status 매핑 확인 =="
fd -t f 'ClubApplication.java' | while read -r f; do
  echo "=== $f ==="
  rg -nP -C3 'class\s+ClubApplication\b' "$f" || true
  rg -nP -C3 '@Enumerated|ApplicationStatus|status\s*;' "$f" || true
done

echo
echo "== ORDINAL 사용 여부 확인 =="
rg -nP '@Enumerated\s*\(\s*EnumType\.ORDINAL\s*\)'

Length of output: 2388


중요: ApplicationStatus enum 값 제거에 따른 데이터/호환성 점검 및 대응 필요

현재 확인 결과,

  • ClubApplication.status 필드는 @Enumerated(EnumType.STRING)으로 매핑 중이며, EnumType.ORDINAL은 사용되지 않습니다.
  • 문자열 기반 매핑이기 때문에 DB에 이미 저장된 제거된 상태값이 존재할 경우 역직렬화 시 예외가 발생할 수 있습니다.

점검 대상:

  • backend/src/main/java/moadong/club/entity/ClubApplication.java
    • @Enumerated(EnumType.STRING) 적용 확인 (라인 29–31)
  • backend/src/main/java/moadong/club/repository/ClubApplicationRepository.java
    • @Query("{ … 'status': { $exists: true, $ne: 'DRAFT' } }") 에서 제거된 값 ‘DRAFT’ 참조 (라인 11)
  • 추가로, SCREENING, SCREENING_PASSED, SCREENING_FAILED, INTERVIEW_IN_PROGRESS, INTERVIEW_PASSED, INTERVIEW_FAILED, OFFERED, CANCELED_BY_APPLICANT 등 다른 제거된 enum 값에 대한 사용처가 남아있는지 전역 검색이 필요합니다.

권장 조치 (필수):

  • DB 마이그레이션
    • 기존에 저장된 제거된 문자열을 신규 상태값으로 일괄 업데이트
  • 레거시 → 신규 상태 매핑
    AttributeConverter<String, ApplicationStatus> 구현(읽기 시 예외 방지)
    • 또는 제거된 enum 값을 일시 @Deprecated 상태로 복원하고, 신규 매핑로직 적용 후 완전 제거
  • 전체 코드베이스에서 제거된 enum 상수 참조 잔여 여부 확인 및 정리

위 조치를 통해 배포 전 데이터 무결성과 호환성을 확보하세요.

🤖 Prompt for AI Agents
In backend/src/main/java/moadong/club/enums/ApplicationStatus.java around lines
3–8, removing enum constants (e.g., DRAFT and other legacy values) will break
deserialization because ClubApplication.status is stored as a STRING; update
steps: run a global search for all removed constants (SCREENING,
SCREENING_PASSED, etc.) and update/clean usages, add a DB migration to replace
legacy string values with the new enum values, and implement an
AttributeConverter<String, ApplicationStatus> (or temporarily restore removed
constants as @Deprecated and route them to new values) so reads do not throw
exceptions until migration and code updates are complete; also verify
backend/src/main/java/moadong/club/entity/ClubApplication.java (lines ~29–31)
uses @Enumerated(EnumType.STRING) and fix repository queries like
backend/src/main/java/moadong/club/repository/ClubApplicationRepository.java
(line ~11) that reference 'DRAFT'.

Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ public ClubApplyInfoResponse getClubApplyInfo(String clubId, CustomUserDetails u
applications.add(ClubApplicantsResult.of(app, cipher));

switch (app.getStatus()) {
case SUBMITTED, SCREENING -> reviewRequired++;
case SCREENING_PASSED, INTERVIEW_SCHEDULED, INTERVIEW_IN_PROGRESS -> scheduledInterview++;
case INTERVIEW_PASSED, OFFERED, ACCEPTED -> accepted++;
case SUBMITTED -> reviewRequired++;
case INTERVIEW_SCHEDULED -> scheduledInterview++;
case ACCEPTED -> accepted++;
}
}

Expand Down
Loading