Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


import greenfirst.be.global.common.response.base.BaseResponse;
import greenfirst.be.global.common.security.CustomUserDetails;
import greenfirst.be.user.adapter.in.web.response.PartnerRelationshipResponse;
import greenfirst.be.user.application.dto.out.PartnerRelationshipOutDto;
import greenfirst.be.user.application.facade.PartnerRelationshipFacade;
Expand All @@ -10,6 +11,7 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -31,6 +33,7 @@ public class GetRelationshipDataController {
/**
* 파트너 관계 조회 API
* 1. (admin) 특정 파트너의 추천인 및 하위 파트너 목록 조회
* 2. (partner) 본인의 추천인 및 하위 파트너 목록 조회
*/

// 1. (admin) 특정 파트너의 추천인 및 하위 파트너 목록 조회
Expand All @@ -48,4 +51,23 @@ public BaseResponse<PartnerRelationshipResponse> getPartnerRelationshipData(@Pat
return new BaseResponse<>(response);
}


// 2. (partner) 본인의 추천인 및 하위 파트너 목록 조회
@Operation(summary = "(partner) 본인의 추천인 및 하위 파트너 목록 조회", description = "(partner) 본인의 추천인 및 하위 파트너 목록 조회", tags = "User - Partner")
@GetMapping("/partner/my")
@PreAuthorize("hasAnyAuthority('PERSONAL_PARTNER', 'CORPORATE_PARTNER')")
@SecurityRequirement(name = "Bearer Auth")
public BaseResponse<PartnerRelationshipResponse> getMyPartnerRelationshipData(
@AuthenticationPrincipal CustomUserDetails authentication) {

// 로그인한 파트너의 추천인 및 하위 파트너 목록 조회
PartnerRelationshipOutDto outDto = partnerRelationshipFacade.getPartnerRelationshipData(
authentication.getUserUuid()
);

// result
PartnerRelationshipResponse response = PartnerRelationshipResponse.from(outDto);
return new BaseResponse<>(response);
}

}
Loading