From 585df93616d52afa9b68c79ae47b968ef26b7daa Mon Sep 17 00:00:00 2001 From: hwan2-99 Date: Wed, 19 Jun 2024 16:28:10 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[refactor]=20=EB=AF=B8=EC=82=AC=EC=9A=A9=20?= =?UTF-8?q?=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=EC=82=AD=EC=A0=9C(Kakao?= =?UTF-8?q?Funding#286)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/funding/controller/FundingController.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/org/kakaoshare/backend/domain/funding/controller/FundingController.java b/src/main/java/org/kakaoshare/backend/domain/funding/controller/FundingController.java index 334c6328..12c85a3b 100644 --- a/src/main/java/org/kakaoshare/backend/domain/funding/controller/FundingController.java +++ b/src/main/java/org/kakaoshare/backend/domain/funding/controller/FundingController.java @@ -51,12 +51,6 @@ public ResponseEntity checkFunding(@RequestBody FundingCheckRequest checkRequ return ResponseEntity.ok(response); } - @GetMapping("/funding/{fundingId}") - public ResponseEntity getFundingProgress(@PathVariable Long fundingId, @LoggedInMember String providerId) { - ProgressResponse response = fundingService.getFundingItemProgress(fundingId, providerId); - return ResponseEntity.ok(response); - } - @PostMapping("/funding/friendItem") public ResponseEntity getFriendFundingProgress(@LoggedInMember String providerId, @RequestBody FriendFundingInquiryRequest inquiryRequest) { From 83e8ac8fa5f188eeee297e3f57674a8f69f8c3af Mon Sep 17 00:00:00 2001 From: hwan2-99 Date: Wed, 19 Jun 2024 16:28:27 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[refactor]=20=EB=AF=B8=EC=82=AC=EC=9A=A9=20?= =?UTF-8?q?=ED=95=84=EB=93=9C=20=EC=82=AD=EC=A0=9C(KakaoFunding#286)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/funding/dto/inquiry/FriendFundingInquiryRequest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/kakaoshare/backend/domain/funding/dto/inquiry/FriendFundingInquiryRequest.java b/src/main/java/org/kakaoshare/backend/domain/funding/dto/inquiry/FriendFundingInquiryRequest.java index 8a39af61..764120d5 100644 --- a/src/main/java/org/kakaoshare/backend/domain/funding/dto/inquiry/FriendFundingInquiryRequest.java +++ b/src/main/java/org/kakaoshare/backend/domain/funding/dto/inquiry/FriendFundingInquiryRequest.java @@ -6,6 +6,5 @@ @Getter @Builder public class FriendFundingInquiryRequest { - private final Long fundingId; private final String friendProviderId; } From 3f3e83504a3f4fe183d4769350c1470d131ff0a5 Mon Sep 17 00:00:00 2001 From: hwan2-99 Date: Wed, 19 Jun 2024 16:40:18 +0900 Subject: [PATCH 3/4] =?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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 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 9e76b535..c674dcee 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,8 +91,12 @@ public ProgressResponse getMyFundingProgress(String providerId) { public ProgressResponse getFriendFundingProgress(String providerId, FriendFundingInquiryRequest inquiryRequest) { Member self = findMemberByProviderId(providerId); Member friend = findMemberByProviderId(inquiryRequest.getFriendProviderId()); //todo 친구 검증 메소드 추가해야함 - Funding funding = findByIdAndMemberId(inquiryRequest.getFundingId(), friend.getMemberId()); - + Funding funding = fundingRepository.findByMemberIdAndStatus(friend.getMemberId(), FundingStatus.PROGRESS) + .orElse(null); + + if (funding == null) { + return new ProgressResponse(); + } return getFundingProgress(funding.getFundingId(), friend.getMemberId()); } From bb89052a2c691cd6052cbb6046fc4ee6be9e3a92 Mon Sep 17 00:00:00 2001 From: hwan2-99 Date: Wed, 19 Jun 2024 23:54:32 +0900 Subject: [PATCH 4/4] =?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,