Skip to content

[ refactor ] 승인 거부 후, 사용자 삭제 시 리소스 정리 로직을 백엔드 service로 위임 #230

Description

@dongmin0204

🛠️ 계획된 리팩토링할 기능

AdminUserService.deleteUbuntuAccount() / AdminUserService.deleteUser()
사용자 및 Ubuntu 계정 삭제 시 인프라 리소스 정리

🛠 사유

기존 코드에서 AdminUserServiceWebClient를 직접 주입받아 Infra Server API를 호출하고 있었다.
이는 이미 PodService, UbuntuAccountService에 분리된 인프라 호출 책임과 중복되며, 다음 문제를 유발:

  1. 책임 중복: 동일한 외부 API 호출 로직이 여러 서비스에 분산
  2. Pod 삭제 누락: 기존 deleteUbuntuAccount()는 Account만 삭제하고 Pod 삭제를 하지 않음
  3. Status 필터링 부재: FULFILLED 상태가 아닌 Request까지 삭제 시도
  4. 에러 처리 불일치: PodService/UbuntuAccountService와 다른 에러 처리 패턴 사용

개선 방향:

  • WebClient 직접 의존 제거 → PodService, UbuntuAccountService로 위임
  • deleteRequestResources() private 메서드로 Pod → Account/PVC → DB 삭제 순서 통일
  • FULFILLED 상태 Request만 리소스 삭제 대상으로 필터링

📝 check-lists

  • AdminUserService에서 WebClient 직접 의존 제거
  • PodService, UbuntuAccountService 의존성 주입으로 교체
  • deleteRequestResources() 메서드 추가 (Pod → Account/PVC → DB 순서)
  • deleteUser() 에서 FULFILLED 상태 필터링 추가
  • deleteUbuntuAccount() 리팩토링
  • AdminUserServiceTest 수정 (WebClient Mock → PodService/UbuntuAccountService Mock)
  • 테스트 통과 확인

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions