From bb89052a2c691cd6052cbb6046fc4ee6be9e3a92 Mon Sep 17 00:00:00 2001 From: hwan2-99 Date: Wed, 19 Jun 2024 23:54:32 +0900 Subject: [PATCH] =?UTF-8?q?[refactor]=20=EC=B9=9C=EA=B5=AC=EC=9D=98=20?= =?UTF-8?q?=ED=8E=80=EB=94=A9=EC=95=84=EC=9D=B4=ED=85=9C=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EC=84=9C=EB=B9=84=EC=8A=A4=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EC=88=98=EC=A0=95(KakaoFunding#286)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/domain/funding/service/FundingService.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/kakaoshare/backend/domain/funding/service/FundingService.java b/src/main/java/org/kakaoshare/backend/domain/funding/service/FundingService.java index c674dcee..5f91bc3d 100644 --- a/src/main/java/org/kakaoshare/backend/domain/funding/service/FundingService.java +++ b/src/main/java/org/kakaoshare/backend/domain/funding/service/FundingService.java @@ -91,13 +91,9 @@ public ProgressResponse getMyFundingProgress(String providerId) { public ProgressResponse getFriendFundingProgress(String providerId, FriendFundingInquiryRequest inquiryRequest) { Member self = findMemberByProviderId(providerId); Member friend = findMemberByProviderId(inquiryRequest.getFriendProviderId()); //todo 친구 검증 메소드 추가해야함 - Funding funding = fundingRepository.findByMemberIdAndStatus(friend.getMemberId(), FundingStatus.PROGRESS) - .orElse(null); - - if (funding == null) { - return new ProgressResponse(); - } - return getFundingProgress(funding.getFundingId(), friend.getMemberId()); + return fundingRepository.findByMemberIdAndStatus(friend.getMemberId(), FundingStatus.PROGRESS) + .map(funding -> getFundingProgress(funding.getFundingId(), friend.getMemberId())) + .orElse(new ProgressResponse()); } public PageResponse getMyFilteredFundingProducts(String providerId, FundingStatus status,