Skip to content

출처 몰 판정을 컨트롤러에서 WishlistService 결과로 이동 - #1050

Open
m-a-king wants to merge 2 commits into
devfrom
refactor/controller-platform-resolver-layering
Open

출처 몰 판정을 컨트롤러에서 WishlistService 결과로 이동#1050
m-a-king wants to merge 2 commits into
devfrom
refactor/controller-platform-resolver-layering

Conversation

@m-a-king

@m-a-king m-a-king commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Situation

  • 위시 컨트롤러가 SourcePlatformResolver 빈을 직접 주입받아, 응답을 만들 때마다 링크에서 출처 몰 표시명을 판정해 DTO 에 넘기고 있었다. 목록·등록·상세 세 곳이 같은 호출을 반복했다.
  • 이 repo 의 컨트롤러 규칙은 "Service 만 호출한다" 다. 컨트롤러가 도메인 빈을 직접 조립하면 같은 판정을 다른 진입점(토너먼트 등)이 다시 각자 하게 되고, 판정 규칙이 바뀔 때 컨트롤러를 뒤져야 한다. pending_uploads 제거와 confirm 단일 신뢰 전환 #1035 정리 중 발견해 후속으로 남겼던 항목이다.

Task

  • 출처 몰 판정을 컨트롤러에서 걷어내고 서비스 경계 한 곳으로 모은다. 응답 계약은 바꾸지 않는다.

Action

변경 전 변경 후
컨트롤러 resolver 주입, 응답 조립마다 판정 호출 WishlistService 만 의존
서비스 결과 (WishWithItem·WishDetail) 판정값 없음 sourcePlatform 을 든다
WishlistService 결과를 그대로 반환 반환 직전 withSourcePlatform 으로 채운다
응답 DTO (wish, item, snapshot, sourcePlatform) 을 따로 받음 결과 객체 하나를 받음
  • 판정 지점은 하나다. WishlistService 의 private 확장 함수가 sourcePlatformResolver.resolve(item.link) 를 호출하고, 컨트롤러로 나가는 모든 경로(등록·이미지 confirm·목록·상세·수기 수정·새로고침)가 그것을 거친다.
  • 영속화 계층은 손대지 않았다. WishPersistenceServiceWishWithItem 을 만드는 8곳은 그대로다. 그래서 WishWithItem.sourcePlatform 은 기본값 null 이고, 서비스 경계가 채운다는 점을 필드 주석 한 줄로 남겼다. WishDetail 은 생성 지점이 서비스 한 곳뿐이라 기본값 없이 필수 인자다.
  • 검토했다가 접은 안: 영속화 계층에서부터 판정값을 실어 올리는 것. resolver 의존이 영속화까지 번지고 생성 지점 8곳을 전부 고쳐야 해서, 응답 경계에서 채우는 쪽이 더 작고 책임도 맞다.

Result

  • 응답 JSON 은 바뀌지 않는다. 등록·상세의 sourcePlatform 값과 이미지 등록의 null 을 단언하는 기존 통합 테스트가 그 계약을 잡고 있다.
  • 목록 응답은 기존 테스트가 sourcePlatform 을 단언하지 않아 목록 경로에서 채우기를 빠뜨려도 통과했다. 판정 지점을 옮기는 김에 목록 단언을 더해 세 경로(등록·목록·상세) 모두 계약이 잡히게 했다.

연관 이슈

- WishlistController 가 SourcePlatformResolver 를 직접 주입받아 응답 조립 때마다 판정을 풀어 넘기던 것을 제거. 컨트롤러는 WishlistService 만 의존한다
- 판정 결과(sourcePlatform)는 WishWithItem·WishDetail 에 실리고, WishlistService 가 응답 경계에서 withSourcePlatform 으로 채운다. 영속화 계층(WishPersistenceService)은 손대지 않아 그쪽 생성 지점 8곳은 그대로다
- 응답 DTO 는 결과 객체만 받는다. WishItemResponse.from(result)·fromRegistration(result)·WishDetailResponse.from(detail, requesterId)

Claude-Session: https://claude.ai/code/session_011f4kWuNL7ritPmuwz7R4c9
- 등록·상세는 기존 테스트가 sourcePlatform 을 단언했지만 목록은 없어, 목록 경로에서 판정을 빠뜨려도 통과했다. 판정 지점을 서비스 경계로 옮기면서 그 구멍을 닫는다

Claude-Session: https://claude.ai/code/session_011f4kWuNL7ritPmuwz7R4c9
@m-a-king m-a-king added the refactor 구조 개선, 외부 동작 불변 label Sep 6, 2026
@m-a-king m-a-king self-assigned this Sep 6, 2026
@coderabbitai

coderabbitai Bot commented Sep 6, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Team

Run ID: a841f07c-df3a-4062-a87a-36adbb9ecbab


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.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Discord 스레드 연동용 메타데이터입니다. discord-pr-bot 워크플로가 자동 생성하며, 수정·삭제하면 PR 과 Discord 알림 연동이 끊깁니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor 구조 개선, 외부 동작 불변

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant