Skip to content

refactor: DTO 변환 중복 코드 제거#342

Merged
yoon6yo merged 1 commit into
developfrom
refactor/dedup-response-dto-336
Jul 12, 2026
Merged

refactor: DTO 변환 중복 코드 제거#342
yoon6yo merged 1 commit into
developfrom
refactor/dedup-response-dto-336

Conversation

@yoon6yo

@yoon6yo yoon6yo commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #336

  • SaveRequestResponseDTO.fromEntity(): fromEntityWithPorts(request, List.of(), List.of())에 위임하여 40줄 중복 빌더 블록 제거
  • RequestQueryService.toResponseDTOs(): private → package-private으로 변경하여 같은 패키지 내 공유 가능
  • AdminRequestQueryService.buildResponseDTOs(): RequestQueryService.toResponseDTOs()에 위임하고 중복 필드(portRequestRepository, podExternalPortRepository) 및 동일 로직 제거

Test plan

  • GET /api/admin/requests — 목록 조회 정상 동작 (portMappings, podExternalPorts 포함)
  • GET /api/admin/requests/new — PENDING 목록 정상 동작
  • POST /api/requests — 신청 생성 응답에 portMappings: [], podExternalPorts: [] 포함 확인

- SaveRequestResponseDTO.fromEntity(): fromEntityWithPorts(request, List.of(), List.of()) 위임으로
  40줄 중복 빌더 블록 제거
- AdminRequestQueryService.buildResponseDTOs(): RequestQueryService.toResponseDTOs() 위임으로
  portRequestRepository/podExternalPortRepository 필드 및 동일 로직 제거
@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: dba04d50-9005-4c23-b653-86b67fcca198

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/dedup-response-dto-336

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

This PR refactors request-to-DTO conversion to remove duplicated builder / batch-loading logic by centralizing it in RequestQueryService and reusing SaveRequestResponseDTO.fromEntityWithPorts(...).

Changes:

  • SaveRequestResponseDTO.fromEntity() now delegates to fromEntityWithPorts(request, List.of(), List.of()) to eliminate duplicated builder code.
  • RequestQueryService.toResponseDTOs(...) visibility changed from private to package-private so it can be reused within the service package.
  • AdminRequestQueryService now delegates request list DTO building to RequestQueryService.toResponseDTOs(...), removing duplicated repositories and mapping logic.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/main/java/DGU_AI_LAB/admin_be/domain/requests/service/RequestQueryService.java Exposes the existing batch DTO conversion helper (package-private) for reuse and centralizes port/pod port batch loading.
src/main/java/DGU_AI_LAB/admin_be/domain/requests/service/AdminRequestQueryService.java Removes duplicated batch-loading code and delegates list-to-DTO conversion to RequestQueryService.
src/main/java/DGU_AI_LAB/admin_be/domain/requests/dto/response/SaveRequestResponseDTO.java Removes duplicated DTO builder block by delegating to the shared fromEntityWithPorts(...) method with empty lists.

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

@yoon6yo
yoon6yo merged commit a171941 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: SaveRequestResponseDTO 및 buildResponseDTOs 코드 중복 제거

2 participants