Skip to content

Comments

[feature] applicationForm delete 구현#854

Merged
alsdddk merged 2 commits intodevelop/befrom
feature/#852-applicationForm-delete-MOA-356
Nov 20, 2025
Merged

[feature] applicationForm delete 구현#854
alsdddk merged 2 commits intodevelop/befrom
feature/#852-applicationForm-delete-MOA-356

Conversation

@alsdddk
Copy link
Collaborator

@alsdddk alsdddk commented Nov 19, 2025

#️⃣연관된 이슈

#852

📝작업 내용

  • 관리자가 해당 지원서 양식을 삭제할 수 있는 api를 구현했습니다.
  1. pathValue로 지원서의 아이디를 받아
  2. 해당 지원서의 지원자들을 모두 삭제하고
  3. 마지막으로 지원서를 삭제합니다.

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

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

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

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

현재는 하드 삭제로 처리하고 있으나,
향후 지원서 데이터를 조회하거나 통계에 활용할 필요가 생기면
소프트 삭제로의 전환도 논의해볼 수 있을 것 같습니다.

🫡 참고사항

Summary by CodeRabbit

  • 새로운 기능
    • 동아리 신청 양식 삭제 기능 추가: 인증된 동아리 관리자는 특정 신청 양식을 삭제할 수 있습니다. 양식 삭제 시 해당 양식에 연관된 모든 신청자 데이터도 함께 삭제되어 데이터 일관성이 유지됩니다. 삭제 작업은 원자적으로 처리되어 중간 상태가 남지 않습니다. 성공 시 확인 메시지가 반환됩니다.

@alsdddk alsdddk self-assigned this Nov 19, 2025
@alsdddk alsdddk added ✨ Feature 기능 개발 📬 API 서버 API 통신 작업 💾 BE Backend labels Nov 19, 2025
@vercel
Copy link

vercel bot commented Nov 19, 2025

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

Project Deployment Preview Comments Updated (UTC)
moadong Ready Ready Preview Comment Nov 19, 2025 3:26am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 19, 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.
  • You can also validate your configuration using the online YAML validator.
  • 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

클럽 지원서 양식 삭제 기능을 추가합니다. 인증된 관리자가 DELETE /api/club/application/{applicationFormId}를 호출하면 서비스가 클럽의 해당 양식을 조회하고 관련 지원자 레코드를 삭제한 뒤 양식 자체를 삭제합니다. 찾지 못하면 APPLICATION_NOT_FOUND 예외를 던집니다.

Changes

코호트 / 파일(s) 변경 요약
컨트롤러 계층
backend/src/main/java/moadong/club/controller/ClubApplyAdminController.java
DELETE /api/club/application/{applicationFormId} 엔드포인트 추가. 인증된 사용자 정보 수신 후 서비스로 위임하고 성공 메시지 반환
서비스 계층
backend/src/main/java/moadong/club/service/ClubApplyAdminService.java
public void deleteClubApplicationForm(String applicationFormId, CustomUserDetails user) 메서드 추가 (@Transactional). clubId와 formId로 양식 조회, 미존재 시 APPLICATION_NOT_FOUND 발생, 관련 지원자 삭제 후 양식 삭제
저장소 계층
backend/src/main/java/moadong/club/repository/ClubApplicantsRepository.java
파생 쿼리 메서드 void deleteAllByFormId(String formId) 추가 — 지정된 formId의 모든 ClubApplicant 레코드 삭제

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller as ClubApplyAdminController
    participant Service as ClubApplyAdminService
    participant FormRepo as ClubApplicationFormRepository
    participant ApplicantRepo as ClubApplicantsRepository

    Client->>Controller: DELETE /api/club/application/{applicationFormId}
    Controller->>Service: deleteClubApplicationForm(applicationFormId, user)
    Service->>FormRepo: findByClubIdAndId(clubId, formId)
    alt Form Not Found
        FormRepo-->>Service: empty
        Service-->>Controller: throw APPLICATION_NOT_FOUND
        Controller-->>Client: 404 응답
    else Form Found
        FormRepo-->>Service: ClubApplicationForm
        Service->>ApplicantRepo: deleteAllByFormId(formId)
        ApplicantRepo-->>Service: delete 완료
        Service->>FormRepo: delete(form)
        FormRepo-->>Service: delete 완료
        Service-->>Controller: void
        Controller-->>Client: 200 성공 메시지
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • 추가로 검토할 항목:
    • @Transactional 범위와 데이터 일관성(삭제 순서 및 롤백 행동)
    • 권한/소유권 검증 로직(요청한 user의 clubId와 양식의 clubId 매칭)
    • Repository 파생 쿼리의 정확성 및 인덱스 영향

Possibly related issues

Possibly related PRs

Suggested reviewers

  • Zepelown
  • lepitaaar
  • PororoAndFriends
  • yw6938

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 변경 사항의 주요 목적을 명확하게 설명합니다. '[feature] applicationForm delete 구현'은 지원서 양식 삭제 기능 구현이라는 핵심 변경 사항을 정확히 전달합니다.
Linked Issues check ✅ Passed PR의 코드 변경 사항이 연결된 이슈 MOA-356의 요구사항과 일치합니다. 지원서 양식 삭제 API 구현이 성공적으로 완료되었으며, 모든 필요한 계층(Controller, Service, Repository)에서 적절한 로직이 구현되었습니다.
Out of Scope Changes check ✅ Passed 모든 변경 사항이 연결된 이슈 MOA-356의 범위 내에 있습니다. 추가된 세 개의 메서드는 모두 지원서 양식 삭제 기능 구현이라는 단일 목표에 직접 관련되어 있습니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/#852-applicationForm-delete-MOA-356

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira 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 dab01a9 and 64d2233.

📒 Files selected for processing (1)
  • backend/src/main/java/moadong/club/service/ClubApplyAdminService.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • backend/src/main/java/moadong/club/service/ClubApplyAdminService.java

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

github-actions bot commented Nov 19, 2025

Test Results

78 tests   75 ✅  15s ⏱️
13 suites   3 💤
13 files     0 ❌

Results for commit 64d2233.

♻️ This comment has been updated with latest results.

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 (2)
backend/src/main/java/moadong/club/service/ClubApplyAdminService.java (1)

127-128: SSE 연결 정리를 고려해보세요.

양식 삭제 시 해당 양식과 연관된 SSE 연결(sseConnections 맵)을 명시적으로 정리하는 것이 좋습니다. 현재는 타임아웃(5분)에 의존하고 있지만, 양식이 삭제된 후 즉시 연결을 종료하면 리소스를 더 효율적으로 관리할 수 있습니다.

다음과 같이 SSE 연결 정리 로직을 추가할 수 있습니다:

 @Transactional
 public void deleteClubApplicationForm(String applicationFormId, CustomUserDetails user) {
     ClubApplicationForm applicationForm = clubApplicationFormsRepository.findByClubIdAndId(user.getClubId(), applicationFormId)
             .orElseThrow(() -> new RestApiException(ErrorCode.APPLICATION_NOT_FOUND));

     clubApplicantsRepository.deleteAllByFormId(applicationForm.getId());
     clubApplicationFormsRepository.delete(applicationForm);
+    
+    // SSE 연결 정리
+    String connectionKeyPrefix = user.getClubId() + "_" + applicationFormId + "_";
+    sseConnections.entrySet().removeIf(entry -> {
+        if (entry.getKey().startsWith(connectionKeyPrefix)) {
+            try {
+                entry.getValue().complete();
+            } catch (Exception ignored) {}
+            return true;
+        }
+        return false;
+    });
 }
backend/src/main/java/moadong/club/controller/ClubApplyAdminController.java (1)

72-80: 엔드포인트가 올바르게 구현되었습니다.

DELETE 엔드포인트가 인증 및 서비스 계층 위임과 함께 적절하게 구현되었습니다. 다음 선택적 개선 사항을 고려해보세요:

  1. API 문서 개선: Operation description에 "양식 삭제 시 관련된 모든 지원자 정보도 함께 삭제됩니다"와 같이 캐스케이드 삭제 동작을 명시하면 API 사용자에게 더 명확합니다.

  2. 입력 검증: applicationFormId에 대한 기본적인 검증(예: @NotBlank)을 추가하여 빈 값 요청을 사전에 방지할 수 있습니다.

선택적으로 다음과 같이 개선할 수 있습니다:

 @DeleteMapping("/application/{applicationFormId}")
-@Operation(summary = "클럽 지원서 양식 삭제", description = "클럽의 지원서 양식을 삭제합니다")
+@Operation(summary = "클럽 지원서 양식 삭제", 
+           description = "클럽의 지원서 양식을 삭제합니다. 양식 삭제 시 관련된 모든 지원자 정보도 함께 삭제됩니다.")
 @PreAuthorize("isAuthenticated()")
 @SecurityRequirement(name = "BearerAuth")
-public ResponseEntity<?> deleteClubApplicationForm(@PathVariable String applicationFormId,
+public ResponseEntity<?> deleteClubApplicationForm(@PathVariable @NotBlank String applicationFormId,
                                                    @CurrentUser CustomUserDetails user) {
     clubApplyAdminService.deleteClubApplicationForm(applicationFormId, user);
     return Response.ok("success delete application");
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira 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 e1ff8bf and dab01a9.

📒 Files selected for processing (3)
  • backend/src/main/java/moadong/club/controller/ClubApplyAdminController.java (1 hunks)
  • backend/src/main/java/moadong/club/repository/ClubApplicantsRepository.java (1 hunks)
  • backend/src/main/java/moadong/club/service/ClubApplyAdminService.java (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-09-30T05:26:41.788Z
Learnt from: alsdddk
Repo: Moadong/moadong PR: 765
File: backend/src/main/java/moadong/club/service/ClubApplyService.java:431-435
Timestamp: 2025-09-30T05:26:41.788Z
Learning: In the Moadong codebase's club application feature (backend/src/main/java/moadong/club/), multiple ClubApplicationForm entities can have ACTIVE status for the same clubId, semesterYear, and semesterTerm simultaneously. There is no uniqueness constraint requiring only one ACTIVE form per semester.

Applied to files:

  • backend/src/main/java/moadong/club/service/ClubApplyAdminService.java
  • backend/src/main/java/moadong/club/repository/ClubApplicantsRepository.java
  • backend/src/main/java/moadong/club/controller/ClubApplyAdminController.java
📚 Learning: 2025-05-19T05:45:52.957Z
Learnt from: lepitaaar
Repo: Moadong/moadong PR: 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/service/ClubApplyAdminService.java
  • backend/src/main/java/moadong/club/repository/ClubApplicantsRepository.java
  • backend/src/main/java/moadong/club/controller/ClubApplyAdminController.java
📚 Learning: 2025-08-25T14:43:52.320Z
Learnt from: lepitaaar
Repo: Moadong/moadong PR: 703
File: backend/src/main/java/moadong/club/controller/ClubApplyController.java:84-84
Timestamp: 2025-08-25T14:43:52.320Z
Learning: In the Moadong codebase, questionId and clubId are equivalent identifiers that represent the same entity. The ClubApplicationRepository.findAllByIdInAndQuestionId method correctly uses clubId as the questionId parameter for filtering club applications.

Applied to files:

  • backend/src/main/java/moadong/club/service/ClubApplyAdminService.java
  • backend/src/main/java/moadong/club/repository/ClubApplicantsRepository.java
  • backend/src/main/java/moadong/club/controller/ClubApplyAdminController.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: test
🔇 Additional comments (1)
backend/src/main/java/moadong/club/repository/ClubApplicantsRepository.java (1)

14-14: LGTM! 파생 쿼리 메서드가 올바르게 추가되었습니다.

Spring Data MongoDB의 명명 규칙을 따르는 삭제 메서드가 적절하게 정의되었습니다. 서비스 계층의 @Transactional 컨텍스트에서 호출되어 데이터 일관성이 보장됩니다.

@yw6938
Copy link
Collaborator

yw6938 commented Nov 19, 2025

수고하셨습니당~

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.

소프트 삭제가 일단 좋은 점이 많아서 추천드리지만 개인 정보 유지 측면에서는 하드 삭제가 간단하긴 하져
수고하셨습니다.

Copy link
Contributor

@lepitaaar lepitaaar left a comment

Choose a reason for hiding this comment

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

수고하셨습니다

@alsdddk alsdddk merged commit c0c5fc6 into develop/be Nov 20, 2025
5 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Dec 23, 2025
@lepitaaar lepitaaar deleted the feature/#852-applicationForm-delete-MOA-356 branch January 18, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📬 API 서버 API 통신 작업 💾 BE Backend ✨ Feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants