[#7] FEAT: 파트너 관계 조회 API에서, 하위 파트너 인센티브 합계 응답 추가#70
Conversation
There was a problem hiding this comment.
Pull request overview
파트너 관계 조회 API 응답에 1차/2차 하위 파트너별 “총 인센티브 합계”를 포함시키기 위해, 인센티브 합계 조회용 Port/Repository 쿼리와 응답 DTO를 확장한 PR입니다.
Changes:
- 하위 파트너 UUID 목록에 대한 총 인센티브 합계를 조회하는 Port 및 Querydsl 집계 쿼리 추가
- 파트너 관계 조회 Facade에서 1차/2차 하위 파트너 데이터에 totalIncentive 매핑 추가
- 컨트롤러 응답 매핑을 ModelMapper 대신
Response.from(...)방식으로 변경 및 관련 테스트 추가
Reviewed changes
Copilot reviewed 6 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/greenfirst/be/user/application/port/out/incentive/IncentiveTotalQueryPort.java | 하위 파트너별 인센티브 합계 조회 Port 신규 추가 |
| src/main/java/greenfirst/be/user/adapter/out/persistence/repository/incentive/IncentiveTotalQueryPortImpl.java | Port 구현체로 IncentiveQueryRepository 집계 조회 위임 |
| src/main/java/greenfirst/be/incentive/application/port/out/IncentiveQueryRepository.java | 파트너 UUID 목록별 합계 조회 메서드 시그니처 추가 |
| src/main/java/greenfirst/be/incentive/adapter/out/persistence/repository/IncentiveQueryRepositoryImpl.java | Querydsl repository로 합계 조회 위임 구현 추가 |
| src/main/java/greenfirst/be/incentive/adapter/out/persistence/querydsl/IncentiveQuerydslRepository.java | partnerUuid 기준 totalIncentive SUM 집계 쿼리 구현 추가 |
| src/main/java/greenfirst/be/user/application/facade/PartnerRelationshipFacade.java | 1/2차 하위 파트너 목록에 totalIncentive를 조회/주입하도록 로직 확장 |
| src/main/java/greenfirst/be/user/application/dto/out/PartnerData.java | 응답에 포함될 totalIncentive 필드 추가 |
| src/main/java/greenfirst/be/user/adapter/in/web/response/PartnerRelationshipResponse.java | 응답 DTO에 builder/from 매핑 로직 추가 |
| src/main/java/greenfirst/be/user/adapter/in/web/controller/GetRelationshipDataController.java | ModelMapper 제거 후 PartnerRelationshipResponse.from 사용으로 매핑 변경 |
| src/test/java/greenfirst/be/users/fake/FakeIncentiveTotalQueryPort.java | Facade 테스트용 IncentiveTotalQueryPort fake 구현 추가 |
| src/test/java/greenfirst/be/user/application/facade/PartnerRelationshipFacadeUnitTest.java | 1/2차 하위 파트너 totalIncentive 포함 및 기본값(0) 테스트 추가 |
| src/test/java/greenfirst/be/incentive/application/IncentiveJobManagementServiceUnitTest.java | IncentiveQueryRepository 인터페이스 확장에 따른 스텁 메서드 추가 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public void setTotals(Map<UUID, BigDecimal> totals) { | ||
| this.totals.clear(); | ||
| this.totals.putAll(totals); | ||
| } |
There was a problem hiding this comment.
setTotals will throw a NullPointerException if the caller passes null (because of putAll). Since this is a reusable test fake, it should either guard against null (treat as empty) or enforce non-null via Objects.requireNonNull(totals) with a clear message.
| public static PartnerRelationshipResponse from(PartnerRelationshipOutDto outDto) { | ||
| if (outDto == null) { | ||
| return null; | ||
| } |
There was a problem hiding this comment.
from(...) is the only *Response.from mapper in the codebase that returns null on null input; other mappers (e.g., IncentiveListResponse.from in src/main/java/greenfirst/be/incentive/adapter/in/web/response/IncentiveListResponse.java:26) assume non-null and fail fast. Consider removing the null-branch (or returning an empty response) to keep mapper behavior consistent.
9d4360f to
660ca56
Compare
Issue ✨
변경점 👍