From 6b573b27383cad02a6b151b08fd1966521130e00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=95=9C=EA=B4=80=ED=9D=AC?= <85067003+limehee@users.noreply.github.com> Date: Mon, 12 Aug 2024 13:27:24 +0900 Subject: [PATCH] =?UTF-8?q?=ED=9A=8C=EB=B9=84=20=EC=A0=95=EB=B3=B4=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=20=EC=8B=9C=20=ED=9A=8C=EB=B9=84=20=EC=9A=94?= =?UTF-8?q?=EC=B2=AD=EC=9E=90=20=EC=A0=95=EB=B3=B4=EA=B0=80=20=EC=9E=98?= =?UTF-8?q?=EB=AA=BB=20=EB=93=A4=EC=96=B4=EA=B0=80=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EC=88=98=EC=A0=95=20=EC=99=84=EB=A3=8C=20(#458)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...MembershipFeesByConditionsRetrievalService.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/page/clab/api/domain/members/membershipFee/application/service/MembershipFeesByConditionsRetrievalService.java b/src/main/java/page/clab/api/domain/members/membershipFee/application/service/MembershipFeesByConditionsRetrievalService.java index b2dcdeff6..2175af583 100644 --- a/src/main/java/page/clab/api/domain/members/membershipFee/application/service/MembershipFeesByConditionsRetrievalService.java +++ b/src/main/java/page/clab/api/domain/members/membershipFee/application/service/MembershipFeesByConditionsRetrievalService.java @@ -5,7 +5,7 @@ import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import page.clab.api.domain.memberManagement.member.application.dto.shared.MemberDetailedInfoDto; +import page.clab.api.domain.memberManagement.member.application.dto.shared.MemberBasicInfoDto; import page.clab.api.domain.members.membershipFee.application.dto.response.MembershipFeeResponseDto; import page.clab.api.domain.members.membershipFee.application.port.in.RetrieveMembershipFeesByConditionsUseCase; import page.clab.api.domain.members.membershipFee.application.port.out.RetrieveMembershipFeePort; @@ -24,9 +24,13 @@ public class MembershipFeesByConditionsRetrievalService implements RetrieveMembe @Transactional(readOnly = true) @Override public PagedResponseDto retrieveMembershipFees(String memberId, String memberName, String category, MembershipFeeStatus status, Pageable pageable) { - MemberDetailedInfoDto memberInfo = externalRetrieveMemberUseCase.getCurrentMemberDetailedInfo(); - Page membershipFeesPage = retrieveMembershipFeePort.findByConditions(memberId, memberName, category, status, pageable); - return new PagedResponseDto<>(membershipFeesPage.map(membershipFee -> - MembershipFeeResponseDto.toDto(membershipFee, memberInfo.getMemberName(), memberInfo.isAdminRole()))); + Page membershipFees = retrieveMembershipFeePort.findByConditions(memberId, memberName, category, status, pageable); + boolean currentMemberIsAdmin = externalRetrieveMemberUseCase.getCurrentMemberDetailedInfo().isAdminRole(); + return new PagedResponseDto<>(membershipFees.map(membership -> getMembershipFeeResponseDto(membership, currentMemberIsAdmin))); + } + + private MembershipFeeResponseDto getMembershipFeeResponseDto(MembershipFee membershipFee, boolean isAdminRole) { + MemberBasicInfoDto memberInfo = externalRetrieveMemberUseCase.getMemberBasicInfoById(membershipFee.getMemberId()); + return MembershipFeeResponseDto.toDto(membershipFee, memberInfo.getMemberName(), isAdminRole); } }