Skip to content

[refactor] be 리팩토링#673

Merged
lepitaaar merged 2 commits intodevelop/befrom
refactor/672-be-refactor
Aug 18, 2025
Merged

[refactor] be 리팩토링#673
lepitaaar merged 2 commits intodevelop/befrom
refactor/672-be-refactor

Conversation

@lepitaaar
Copy link
Contributor

@lepitaaar lepitaaar commented Aug 18, 2025

#️⃣연관된 이슈

불필요한 status 제거했습니다

📝작업 내용

이번 PR에서 작업한 내용을 간략히 설명해주세요(이미지/동영상 첨부 가능)

중점적으로 리뷰받고 싶은 부분(선택)

리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요

ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요?

논의하고 싶은 부분(선택)

논의하고 싶은 부분이 있다면 작성해주세요.

🫡 참고사항

Summary by CodeRabbit

  • 문서화
    • 지원서 수정/삭제 API 설명 문구를 더 자연스러운 한국어로 수정했습니다.
  • 리팩터
    • 지원 상태 체계를 4가지(제출됨, 인터뷰 예정, 합격, 거절됨)로 간소화했습니다. 앱과 API 응답에서 이 상태들만 노출됩니다.
  • 버그 수정
    • 대시보드/요약에서 지원 상태별 집계 로직을 새 상태 체계에 맞게 정리해 더 일관된 카운트를 제공합니다.

@lepitaaar lepitaaar self-assigned this Aug 18, 2025
@lepitaaar lepitaaar added 🔨 Refactor 코드 리팩토링 💾 BE Backend labels Aug 18, 2025
@vercel
Copy link

vercel bot commented Aug 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
moadong Ready Ready Preview Comment Aug 18, 2025 3:29am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 18, 2025

Warning

.coderabbit.yaml has a parsing error

The CodeRabbit configuration file in this repository has a parsing error and default settings were used instead. Please fix the error(s) in the configuration file. You can initialize chat with CodeRabbit to get help with the configuration file.

💥 Parsing errors (1)
Validation error: Invalid regex pattern for base branch. Received: "**" at "reviews.auto_review.base_branches[0]"
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

컨트롤러의 OpenAPI 설명 문구를 일부 수정하고, ApplicationStatus enum에서 여러 상태를 제거했으며, ClubApplyService.getClubApplyInfo 내 상태별 카운팅 로직을 단순화했습니다. 그 외 공개 API 시그니처 변경이나 비즈니스 로직 추가는 없습니다.

Changes

Cohort / File(s) Summary
OpenAPI 문구 정정
backend/src/main/java/moadong/club/controller/ClubApplyController.java
PUT/DELETE /apply/{appId} 설명의 “클럽 자원자”를 “클럽 지원자”로 정정. 기능 변경 없음.
ApplicationStatus 축소
backend/src/main/java/moadong/club/enums/ApplicationStatus.java
enum 상수 대폭 제거: DRAFT, SCREENING, SCREENING_PASSED, SCREENING_FAILED, INTERVIEW_IN_PROGRESS, INTERVIEW_PASSED, INTERVIEW_FAILED, OFFERED, CANCELED_BY_APPLICANT 삭제. SUBMITTED, INTERVIEW_SCHEDULED, ACCEPTED, DECLINED만 유지. 코멘트 한글화.
카운팅 로직 단순화
backend/src/main/java/moadong/club/service/ClubApplyService.java
getClubApplyInfo에서 상태→카운터 매핑 축소: SUBMITTED→reviewRequired, INTERVIEW_SCHEDULED→scheduledInterview, ACCEPTED→accepted만 집계. 나머지 상태는 미집계.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Controller
  participant Service as ClubApplyService
  participant Repo as Repository

  Client->>Controller: getClubApplyInfo 요청
  Controller->>Service: getClubApplyInfo()
  Service->>Repo: ClubApplication 목록 조회
  Repo-->>Service: applications
  loop 각 application
    Service->>Service: status 분기\nSUBMITTED → reviewRequired++\nINTERVIEW_SCHEDULED → scheduledInterview++\nACCEPTED → accepted++\n기타 → 무시
  end
  Service-->>Controller: 집계 결과
  Controller-->>Client: 응답
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • Zepelown
  • seongwon030

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/672-be-refactor

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link

Test Results

75 tests   75 ✅  2s ⏱️
12 suites   0 💤
12 files     0 ❌

Results for commit dcb2b5c.

Copy link
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 (3)
backend/src/main/java/moadong/club/enums/ApplicationStatus.java (1)

6-7: 주석 오타 및 용어 의미 명확화 제안

"불합"은 "불합격"의 축약으로 보입니다. 주석을 명확히 해주세요. 또한 DECLINED는 ‘관리자 거절’인지 ‘지원자 측 거절(포기)’인지 의미가 다를 수 있으니 주석으로 구분을 권장합니다.

적용 예시:

-    ACCEPTED,                  // 합격
-    DECLINED,                  // 불합
+    ACCEPTED,                  // 합격
+    DECLINED,                  // 불합격(거절)
backend/src/main/java/moadong/club/service/ClubApplyService.java (2)

109-116: 상태 집계 단순화 영향 확인 요청

이제 SUBMITTED/INTERVIEW_SCHEDULED/ACCEPTED만 카운팅됩니다. 과거에 집계되던(제거된) 중간 단계들이 제외되어 대시보드/통계 지표가 하향 조정될 수 있습니다. 또한 DECLINED는 총계에는 포함되지만 개별 카운터에는 반영되지 않습니다.

확인 사항:

  • 프론트/운영 대시보드가 해당 3개 지표만을 기대하는지
  • DECLINED에 대한 별도 카운트가 필요한지
  • 제거된 상태값으로 저장된 기존 데이터가 있을 경우, 카운트 불일치가 수용 가능한지

원하시면 카운트 항목 정의(스펙) 정리 및 마이그레이션 스크립트 제안해드리겠습니다.


112-116: 방어적 코딩: switch 기본 분기 추가 제안

향후 새로운 상태가 추가되거나(또는 예상치 못한 값) 들어올 경우를 대비해 기본 분기를 두는 편이 안전합니다. 현재 로직에 영향 없이 무시 처리할 수 있습니다.

-            switch (app.getStatus()) {
-                case SUBMITTED -> reviewRequired++;
-                case INTERVIEW_SCHEDULED -> scheduledInterview++;
-                case ACCEPTED -> accepted++;
-            }
+            switch (app.getStatus()) {
+                case SUBMITTED -> reviewRequired++;
+                case INTERVIEW_SCHEDULED -> scheduledInterview++;
+                case ACCEPTED -> accepted++;
+                default -> { /* intentionally ignored */ }
+            }

참고: app.getStatus()가 null일 가능성이 있다면 switch 전에 null 가드도 고려해 주세요.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f1c6f2d and dcb2b5c.

📒 Files selected for processing (3)
  • backend/src/main/java/moadong/club/controller/ClubApplyController.java (2 hunks)
  • backend/src/main/java/moadong/club/enums/ApplicationStatus.java (1 hunks)
  • backend/src/main/java/moadong/club/service/ClubApplyService.java (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-05-19T05:45:52.957Z
Learnt from: lepitaaar
PR: Moadong/moadong#406
File: backend/src/main/java/moadong/club/service/ClubApplyService.java:34-38
Timestamp: 2025-05-19T05:45:52.957Z
Learning: The code duplication between createClubApplication and editClubApplication methods in ClubApplyService.java is acknowledged but will be addressed in a future refactoring, as per the developer's plan.

Applied to files:

  • backend/src/main/java/moadong/club/controller/ClubApplyController.java
  • backend/src/main/java/moadong/club/service/ClubApplyService.java
🔇 Additional comments (2)
backend/src/main/java/moadong/club/controller/ClubApplyController.java (2)

75-77: 문구 수정 LGTM

"자원자" → "지원자"로의 표기 수정 적절합니다. OpenAPI 문서 가독성 향상에 도움 됩니다.


90-92: 문구 수정 LGTM

삭제 설명 문구의 "지원자" 표기 통일 좋습니다.

Comment on lines 3 to 8
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, // 불합
} No newline at end of file
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'.

Copy link
Member

@Zepelown Zepelown left a comment

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

💾 BE Backend 🔨 Refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants