Skip to content

refactor: 도달 불가 코드 및 중복 DB 조회 제거#341

Merged
yoon6yo merged 1 commit into
developfrom
refactor/remove-dead-code-335
Jul 12, 2026
Merged

refactor: 도달 불가 코드 및 중복 DB 조회 제거#341
yoon6yo merged 1 commit into
developfrom
refactor/remove-dead-code-335

Conversation

@yoon6yo

@yoon6yo yoon6yo commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #335

  • UserService.userAuth(): findByUbuntuUsernameAndUbuntuPasswordBase64 쿼리가 이미 비밀번호 일치를 보장하므로 이중 확인 블록 제거 (L75-80)
  • UbuntuAccountService.deleteUbuntuAccount(): onStatus가 404를 Mono.empty()로 처리하므로 catch 내 WebClientResponseException NOT_FOUND 분기는 도달 불가 — 제거 및 unused import 정리
  • RequestCommandService.createModificationRequest/createSingleChangeRequest: userId 소유권 검증 직후에 originalRequest.getUser()로 동일 User를 얻을 수 있으므로 userRepository.findById(userId) 재조회 제거

Test plan

  • UserService.userAuth(): username/password 불일치 시 USER_NOT_FOUND 반환 확인
  • UbuntuAccountService.deleteUbuntuAccount(): 404 응답 시 예외 없이 정상 종료 확인, 500 응답 시 BusinessException 발생 확인
  • RequestCommandService.createModificationRequest: 정상 변경 요청 생성 확인

- UserService.userAuth(): DB 쿼리 조건에 이미 검증된 비밀번호 이중 확인 블록 제거
- UbuntuAccountService.deleteUbuntuAccount(): onStatus가 이미 404를 처리하므로
  catch 내 WebClientResponseException NOT_FOUND 분기 제거
- RequestCommandService: createModificationRequest/createSingleChangeRequest에서
  이미 로드된 originalRequest.getUser()로 불필요한 userRepository 재조회 대체
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b78cd20f-5f99-4acd-b527-c35e65dcad30

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 refactor/remove-dead-code-335

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

이 PR은 도달 불가(dead) 코드와 중복 DB 조회를 제거해 서비스 로직을 단순화하고 불필요한 비용/분기를 줄이는 리팩터링입니다.

Changes:

  • UserService.userAuth()에서 쿼리 단계에서 이미 비밀번호 일치가 보장되는 추가 검증 분기를 제거
  • UbuntuAccountService.deleteUbuntuAccount()에서 404 예외 분기 제거 및 unused import 정리
  • RequestCommandService에서 요청 소유권 검증 이후 동일 User를 재조회하던 로직 제거

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/main/java/DGU_AI_LAB/admin_be/domain/users/service/UserService.java 인증 로직에서 중복 비밀번호 검증(도달 불가/불필요 가능) 제거로 흐름 단순화
src/main/java/DGU_AI_LAB/admin_be/domain/requests/service/UbuntuAccountService.java 404 처리 분기 제거 및 예외 처리 정리(단, BusinessException 래핑 이슈 확인 필요)
src/main/java/DGU_AI_LAB/admin_be/domain/requests/service/RequestCommandService.java 소유권 검증 후 동일 User 재조회 제거로 불필요한 DB 접근 감소

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 52 to 55
} catch (Exception e) {
if (!(e instanceof WebClientResponseException && ((WebClientResponseException)e).getStatusCode() == HttpStatus.NOT_FOUND)) {
log.error("사용자 삭제 API 호출 중 예기치 않은 오류: {}", username, e);
throw new BusinessException("사용자 삭제 API 호출 오류", ErrorCode.INTERNAL_SERVER_ERROR);
}
log.error("사용자 삭제 API 호출 중 예기치 않은 오류: {}", username, e);
throw new BusinessException("사용자 삭제 API 호출 오류", ErrorCode.INTERNAL_SERVER_ERROR);
}
@yoon6yo
yoon6yo merged commit 5307335 into develop Jul 12, 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.

refactor: 코드 품질 개선 - dead code 제거 및 불필요한 재조회 삭제

2 participants