Skip to content

[#7] FEAT: '본인/다른유저 프로필 조회 API'의 응답값에, 추천인 전화번호 추가#72

Merged
Hwan0518 merged 1 commit intodevelopfrom
feature/partner/refactor
Jan 27, 2026
Merged

[#7] FEAT: '본인/다른유저 프로필 조회 API'의 응답값에, 추천인 전화번호 추가#72
Hwan0518 merged 1 commit intodevelopfrom
feature/partner/refactor

Conversation

@Hwan0518
Copy link
Contributor

Issue ✨

변경점 👍

  • '본인 프로필 조회 API'의 응답값에, 추천인 전화번호 추가

Copilot AI review requested due to automatic review settings January 27, 2026 09:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

본인 프로필 조회 API 응답에 “추천인(Referrer) 전화번호”를 포함시키기 위한 변경입니다.

Changes:

  • UserProfileResponsereferrerPhoneNumber 필드 추가
  • /profile/my 응답 생성 시 추천인 전화번호를 조회하여 매핑
  • GetUserDataService에 추천인 전화번호 조회 로직 및 관련 테스트 의존성 주입 반영

Reviewed changes

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

Show a summary per file
File Description
src/main/java/greenfirst/be/user/application/service/GetUserDataService.java 추천인(파트너 관계 기반) 전화번호 조회 메서드 및 의존성 추가
src/main/java/greenfirst/be/user/adapter/in/web/response/UserProfileResponse.java 응답 DTO에 referrerPhoneNumber 필드 추가
src/main/java/greenfirst/be/user/adapter/in/web/controller/GetUserDataController.java /profile/my에서 추천인 전화번호 조회/매핑 추가
src/test/java/greenfirst/be/user/application/GetUserDataServiceUnitTest.java GetUserDataService 생성자 변경에 맞춰 테스트 세팅 수정
src/test/java/greenfirst/be/user/application/facade/PartnerRelationshipFacadeUnitTest.java GetUserDataService 생성자 변경에 맞춰 테스트 세팅 수정

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

Comment on lines 128 to 134
// 8. 파트너 추천인 전화번호 조회
public String getReferrerPhoneNumber(UUID partnerUuid) {
if (partnerUuid == null) {
return null;
}

Optional<PartnerRelationship> relationshipOptional = getPartnerRelationshipDataService.getPartnerRelationshipDataOptional(partnerUuid);
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

getReferrerPhoneNumber(UUID partnerUuid) is invoked from the controller with a generic userUuid, and the logic also works for non-partner users (it just returns null). To avoid confusion for future callers, consider renaming the parameter (and/or method) to reflect the accepted input (e.g., userUuid or targetUserUuid), or make it explicitly partner-only and enforce that contract.

Suggested change
// 8. 파트너 추천인 전화번호 조회
public String getReferrerPhoneNumber(UUID partnerUuid) {
if (partnerUuid == null) {
return null;
}
Optional<PartnerRelationship> relationshipOptional = getPartnerRelationshipDataService.getPartnerRelationshipDataOptional(partnerUuid);
// 8. 유저 추천인 전화번호 조회
public String getReferrerPhoneNumber(UUID userUuid) {
if (userUuid == null) {
return null;
}
Optional<PartnerRelationship> relationshipOptional = getPartnerRelationshipDataService.getPartnerRelationshipDataOptional(userUuid);

Copilot uses AI. Check for mistakes.
Comment on lines 128 to 150
// 8. 파트너 추천인 전화번호 조회
public String getReferrerPhoneNumber(UUID partnerUuid) {
if (partnerUuid == null) {
return null;
}

Optional<PartnerRelationship> relationshipOptional = getPartnerRelationshipDataService.getPartnerRelationshipDataOptional(partnerUuid);
if (relationshipOptional.isEmpty()) {
return null;
}

UUID referrerUuid = relationshipOptional.get().getReferrerUuid();
if (referrerUuid == null) {
return null;
}

List<Users> referrerCandidates = userQueryRepository.getUsersByUuidInList(List.of(referrerUuid));
if (referrerCandidates.isEmpty()) {
return null;
}

return referrerCandidates.get(0).getUserPhoneNumber();
}
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

New behavior in getReferrerPhoneNumber(...) isn’t covered by unit tests in this file. Please add tests for at least: (1) no PartnerRelationship -> null, (2) relationship exists but referrerUuid is null -> null, and (3) relationship + referrer user exists -> returns the referrer’s phone number.

Copilot uses AI. Check for mistakes.
Comment on lines 150 to 158
// 추천인 전화번호 조회
String referrerPhoneNumber = getUserDataService.getReferrerPhoneNumber(user.getUserUuid());

// mapping
UserProfileResponse response = modelMapper.map(user, UserProfileResponse.class)
.toBuilder()
.vehicleNumber(vehicleNumber)
.referrerPhoneNumber(referrerPhoneNumber)
.build();
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

UserProfileResponse now includes referrerPhoneNumber, but only /profile/my populates it; /profile/{userUuid} still returns the same response type and will leave this field null (and likely still serialized). Either populate referrerPhoneNumber for the other profile endpoint as well, or split the response DTOs / adjust JSON inclusion so the field doesn’t appear for endpoints that don’t support it.

Copilot uses AI. Check for mistakes.
@Hwan0518 Hwan0518 force-pushed the feature/partner/refactor branch from 00975d4 to 5d1a103 Compare January 27, 2026 09:49
@Hwan0518 Hwan0518 changed the title [#7] FEAT: '본인 프로필 조회 API'의 응답값에, 추천인 전화번호 추가 [#7] FEAT: '본인/다른유저 프로필 조회 API'의 응답값에, 추천인 전화번호 추가 Jan 27, 2026
@Hwan0518 Hwan0518 merged commit 9683227 into develop Jan 27, 2026
@Hwan0518 Hwan0518 deleted the feature/partner/refactor branch January 27, 2026 09:49
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.

1 participant