From 67ca7933dd970c73e95a040c9c32d1edb926f26c Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Sat, 29 Jun 2024 22:55:47 +0900 Subject: [PATCH 1/8] =?UTF-8?q?[feat]=20=EC=B1=84=EC=86=8C=20=EB=8F=84?= =?UTF-8?q?=EC=9B=80=EB=A7=90=20=EC=A0=84=EC=B2=B4=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FarmClubController.java | 8 ++++--- .../dto/res/GetHelpAllResponseDto.java | 21 +++++++++++++++++++ .../farmclub/service/FarmClubService.java | 7 +++++++ 3 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetHelpAllResponseDto.java diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/controller/FarmClubController.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/controller/FarmClubController.java index f063fd07..d37aa589 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/controller/FarmClubController.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/controller/FarmClubController.java @@ -124,8 +124,10 @@ public BaseResponseDto getMyVeggieForRegister( return BaseResponseDto.of(SuccessCode.SUCCESS, farmClubService.getMyVeggie(user.getUserId(), veggieInfoId)); } - @GetMapping("/help") - public BaseResponseDto getFarmClubHelp() { - return null; + @GetMapping("/{farmClubId}/help") + public BaseResponseDto getFarmClubHelp( + @PathVariable String farmClubId + ) { + return BaseResponseDto.of(SuccessCode.SUCCESS, farmClubService.getHelpAll(farmClubId)); } } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetHelpAllResponseDto.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetHelpAllResponseDto.java new file mode 100644 index 00000000..d602edcd --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetHelpAllResponseDto.java @@ -0,0 +1,21 @@ +package com.modernfarmer.farmusspring.domain.farmclub.dto.res; + +import com.modernfarmer.farmusspring.domain.veggieinfo.entity.VeggieInfo; +import com.modernfarmer.farmusspring.domain.veggieinfo.vo.StepVo; +import lombok.AccessLevel; +import lombok.Builder; + +import java.util.List; + +@Builder(access = AccessLevel.PRIVATE) +public record GetHelpAllResponseDto( + VeggieInfo.Help help, + List steps +) { + public static GetHelpAllResponseDto of(VeggieInfo.Help help, List steps) { + return builder() + .help(help) + .steps(steps) + .build(); + } +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java index 1fb7b67c..0f4e5a82 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java @@ -109,6 +109,13 @@ public GetMyVeggieResponseDto getMyVeggie(Long userId, String veggieInfoId) { return GetMyVeggieResponseDto.of(myVeggie.myVeggieId(), myVeggie.nickname()); } + public GetHelpAllResponseDto getHelpAll(String veggieInfoId) { + VeggieInfo.Help help = veggieInfoHelper.getVeggieInfoHelp(veggieInfoId); + List steps = veggieInfoHelper.getStepList(veggieInfoId); + return GetHelpAllResponseDto.of(help, steps); + } + + private String getRandomTip(List stepList) { List tips = new ArrayList<>(); stepList.forEach(step -> tips.addAll(step.tips())); From 92d79ae7507a3218fe6f7b6e375caaa4fbbf9f00 Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Wed, 3 Jul 2024 09:09:09 +0900 Subject: [PATCH 2/8] =?UTF-8?q?[feat]=20=ED=8C=9C=ED=81=B4=EB=9F=BD=20?= =?UTF-8?q?=ED=83=88=ED=87=B4=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FarmClubController.java | 12 +++++++++- .../repository/UserFarmClubRepository.java | 2 +- .../UserFarmClubRepositoryCustom.java | 8 +++++++ .../UserFarmClubRepositoryImpl.java | 23 +++++++++++++++++++ .../farmclub/service/FarmClubService.java | 15 +++++++++++- 5 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/UserFarmClubRepositoryCustom.java create mode 100644 src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/UserFarmClubRepositoryImpl.java diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/controller/FarmClubController.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/controller/FarmClubController.java index d37aa589..33da645f 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/controller/FarmClubController.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/controller/FarmClubController.java @@ -126,8 +126,18 @@ public BaseResponseDto getMyVeggieForRegister( @GetMapping("/{farmClubId}/help") public BaseResponseDto getFarmClubHelp( - @PathVariable String farmClubId + @PathVariable Long farmClubId ) { return BaseResponseDto.of(SuccessCode.SUCCESS, farmClubService.getHelpAll(farmClubId)); } + + @DeleteMapping + public BaseResponseDto withdrawFarmClub( + @RequestParam Long farmClubId, + @RequestParam Boolean deleteVeggie, + @AuthenticationPrincipal CustomUser user + ) { + farmClubService.withdrawFarmClub(farmClubId, user.getUserId(), deleteVeggie); + return BaseResponseDto.of(SuccessCode.SUCCESS, null); + } } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/UserFarmClubRepository.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/UserFarmClubRepository.java index 2ece949d..8d2015bb 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/UserFarmClubRepository.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/UserFarmClubRepository.java @@ -3,5 +3,5 @@ import com.modernfarmer.farmusspring.domain.farmclub.entity.UserFarmClub; import org.springframework.data.jpa.repository.JpaRepository; -public interface UserFarmClubRepository extends JpaRepository { +public interface UserFarmClubRepository extends JpaRepository, UserFarmClubRepositoryCustom { } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/UserFarmClubRepositoryCustom.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/UserFarmClubRepositoryCustom.java new file mode 100644 index 00000000..c7ec6c1e --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/UserFarmClubRepositoryCustom.java @@ -0,0 +1,8 @@ +package com.modernfarmer.farmusspring.domain.farmclub.repository; + +import com.modernfarmer.farmusspring.domain.farmclub.entity.UserFarmClub; + +public interface UserFarmClubRepositoryCustom { + + UserFarmClub findByUserIdAndFarmClubId(Long userId, Long farmClubId); +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/UserFarmClubRepositoryImpl.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/UserFarmClubRepositoryImpl.java new file mode 100644 index 00000000..1c80756c --- /dev/null +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/repository/UserFarmClubRepositoryImpl.java @@ -0,0 +1,23 @@ +package com.modernfarmer.farmusspring.domain.farmclub.repository; + +import com.modernfarmer.farmusspring.domain.farmclub.entity.UserFarmClub; +import com.querydsl.jpa.impl.JPAQueryFactory; +import lombok.RequiredArgsConstructor; + +import static com.modernfarmer.farmusspring.domain.farmclub.entity.QUserFarmClub.userFarmClub; + +@RequiredArgsConstructor +public class UserFarmClubRepositoryImpl implements UserFarmClubRepositoryCustom { + + private final JPAQueryFactory queryFactory; + + @Override + public UserFarmClub findByUserIdAndFarmClubId(Long userId, Long farmClubId) { + return queryFactory + .select(userFarmClub) + .from(userFarmClub) + .where(userFarmClub.userId.eq(userId) + .and(userFarmClub.farmClub.id.eq(farmClubId))) + .fetchOne(); + } +} diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java index 0f4e5a82..fc5140be 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java @@ -7,6 +7,7 @@ import com.modernfarmer.farmusspring.domain.farmclub.helper.FarmClubHelper; import com.modernfarmer.farmusspring.domain.farmclub.repository.FarmClubRepository; import com.modernfarmer.farmusspring.domain.farmclub.repository.MissionPostRepository; +import com.modernfarmer.farmusspring.domain.farmclub.repository.UserFarmClubRepository; import com.modernfarmer.farmusspring.domain.farmclub.vo.GetMissionPostListWithStepCountsAndImagesVo; import com.modernfarmer.farmusspring.domain.farmclub.vo.GetMyFarmClubVo; import com.modernfarmer.farmusspring.domain.myveggiegarden.entity.MyVeggie; @@ -30,6 +31,7 @@ @RequiredArgsConstructor @Slf4j public class FarmClubService { + private final UserFarmClubRepository userFarmClubRepository; private final FarmClubHelper farmClubHelper; private final VeggieInfoHelper veggieInfoHelper; @@ -109,12 +111,23 @@ public GetMyVeggieResponseDto getMyVeggie(Long userId, String veggieInfoId) { return GetMyVeggieResponseDto.of(myVeggie.myVeggieId(), myVeggie.nickname()); } - public GetHelpAllResponseDto getHelpAll(String veggieInfoId) { + public GetHelpAllResponseDto getHelpAll(Long farmClubId) { + String veggieInfoId = farmClubHelper.getFarmClubEntity(farmClubId).getVeggieInfoId(); VeggieInfo.Help help = veggieInfoHelper.getVeggieInfoHelp(veggieInfoId); List steps = veggieInfoHelper.getStepList(veggieInfoId); return GetHelpAllResponseDto.of(help, steps); } + // 팜클럽 탈퇴 + public void withdrawFarmClub(Long farmClubId, Long userId, Boolean deleteVeggie) { + UserFarmClub userFarmClub = userFarmClubRepository.findByUserIdAndFarmClubId(userId, farmClubId); + userFarmClubRepository.deleteById(userFarmClub.getId()); + if (deleteVeggie) { + Long myVeggieId = userFarmClub.getMyVeggie().getId(); + myVeggieHelper.getMyVeggieEntity(myVeggieId); + myVeggieHelper.deleteMyVeggie(myVeggieId); + } + } private String getRandomTip(List stepList) { List tips = new ArrayList<>(); From c6609bfb60690181dd21f2d3f5d55491de60db77 Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Wed, 3 Jul 2024 09:09:18 +0900 Subject: [PATCH 3/8] =?UTF-8?q?[feat]=20=EC=B1=84=EC=86=8C=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=20=ED=97=AC=ED=8D=BC=20=EB=A9=94=EC=84=9C=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/myveggiegarden/helper/MyVeggieHelper.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/helper/MyVeggieHelper.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/helper/MyVeggieHelper.java index d303bc01..0815b9be 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/helper/MyVeggieHelper.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/helper/MyVeggieHelper.java @@ -26,4 +26,8 @@ public MyVeggieVo getMyVeggieInfo(Long userId, String veggieInfoId) { return myVeggieRepository.findMyVeggieInfo(userId, veggieInfoId).orElse(MyVeggieVo.of(0L, "")); } + + public void deleteMyVeggie(Long id) { + myVeggieRepository.deleteById(id); + } } From cc872f3533c3f7c027765df52e4727ebcf670177 Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Wed, 3 Jul 2024 09:40:01 +0900 Subject: [PATCH 4/8] =?UTF-8?q?[feat]=20=EC=8A=A4=ED=85=9D=EB=AA=85=20?= =?UTF-8?q?=EB=B6=88=EB=9F=AC=EC=98=A4=EB=8A=94=20=ED=97=AC=ED=8D=BC=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/veggieinfo/helper/VeggieInfoHelper.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/veggieinfo/helper/VeggieInfoHelper.java b/src/main/java/com/modernfarmer/farmusspring/domain/veggieinfo/helper/VeggieInfoHelper.java index ca22cafc..d0f5807f 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/veggieinfo/helper/VeggieInfoHelper.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/veggieinfo/helper/VeggieInfoHelper.java @@ -34,4 +34,9 @@ public VeggieInfoVo getVeggieInfo(String veggieInfoId) { public List getStepList(String veggieInfoId) { return veggieInfoRepository.getVeggieInfoStepList(veggieInfoId); } + + public String getStepName(String veggieInfoId, int step) { + List stepList = getStepList(veggieInfoId); + return stepList.get(step).content(); + } } From ea88bf8b0c2dee21cc9a8cce5bc4b9fa7eb0a293 Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Wed, 3 Jul 2024 09:40:20 +0900 Subject: [PATCH 5/8] =?UTF-8?q?[fix]=20=EB=AF=B8=EC=85=98,=20=EC=8A=A4?= =?UTF-8?q?=ED=85=9D=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../farmusspring/domain/farmclub/entity/UserFarmClub.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/UserFarmClub.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/UserFarmClub.java index 230db14b..0430504b 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/UserFarmClub.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/entity/UserFarmClub.java @@ -57,9 +57,9 @@ public static UserFarmClub createUserFarmClub(Long userId, String currentStepNam return newUserFarmClub; } - public void updateCurrentStep(int currentStep, String currentStepName){ - this.currentStep = currentStep; - this.currentStepName = currentStepName; + public void updateStep(String nextStep){ + this.currentStep = this.getCurrentStep() + 1; + this.currentStepName = nextStep; } public void addMissionPost(MissionPost missionPost){ From edb6e1458f050601fb530494e7f9f0b807aa4bd7 Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Wed, 3 Jul 2024 09:41:14 +0900 Subject: [PATCH 6/8] =?UTF-8?q?[fix]=20=EB=AF=B8=EC=85=98=20=EC=97=85?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EC=8B=9C=20=EC=8A=A4=ED=85=9D=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=20=EC=97=85=EB=8D=B0=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/farmclub/service/MissionPostService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/MissionPostService.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/MissionPostService.java index df5f3a04..ccd0e7be 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/MissionPostService.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/MissionPostService.java @@ -14,6 +14,7 @@ import com.modernfarmer.farmusspring.domain.farmclub.vo.MissionPostVo; import com.modernfarmer.farmusspring.domain.user.entity.User; import com.modernfarmer.farmusspring.domain.user.helper.UserHelper; +import com.modernfarmer.farmusspring.domain.veggieinfo.helper.VeggieInfoHelper; import com.modernfarmer.farmusspring.infra.s3.S3Service; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -33,14 +34,18 @@ public class MissionPostService { private final UserFarmClubHelper userFarmClubHelper; private final MissionPostHelper missionPostHelper; private final UserHelper userHelper; + private final VeggieInfoHelper veggieInfoHelper; private final S3Service s3Service; + @Transactional public CreateMissionPostResponseDto createMissionPost(CreateMissionPostRequestDto request, MultipartFile image) { UserFarmClub userFarmClub = userFarmClubHelper.getUserFarmClubEntity(request.userFarmClubId()); String imageUrl = s3Service.uploadImage(image, "mission-post"); - Long missionPostId = saveMissionPost(request.toEntity(userFarmClub, imageUrl)).getId(); - return CreateMissionPostResponseDto.of(missionPostId); + MissionPost missionPost = saveMissionPost(request.toEntity(userFarmClub, imageUrl)); + userFarmClub.addMissionPost(missionPost); + userFarmClub.updateStep(veggieInfoHelper.getStepName(userFarmClub.getFarmClub().getVeggieInfoId(), userFarmClub.getCurrentStep())); + return CreateMissionPostResponseDto.of(missionPost.getId()); } @Transactional From b94dc344136707c291df95bead19322a0ecef031 Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Wed, 3 Jul 2024 09:41:31 +0900 Subject: [PATCH 7/8] =?UTF-8?q?[fix]=20=ED=8C=9C=ED=81=B4=EB=9F=BD=20?= =?UTF-8?q?=EA=B0=80=EC=9E=85=20=EC=8B=9C=200=EB=B2=88=20=EC=8A=A4?= =?UTF-8?q?=ED=85=9D=EB=AA=85=EC=9C=BC=EB=A1=9C=20=EC=B4=88=EA=B8=B0?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../farmusspring/domain/farmclub/service/FarmClubService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java index fc5140be..6d2246aa 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/service/FarmClubService.java @@ -80,7 +80,7 @@ public RegisterFarmClubResponseDto registerFarmClub(Long farmClubId, Long myVegg MyVeggie myVeggie = myVeggieHelper.getMyVeggieEntity(myVeggieId); FarmClub farmClub = farmClubHelper.getFarmClubEntity(farmClubId); // 채소정보 id로 채소의 첫 스텝명 불러옴 - String stepName = ""; + String stepName = veggieInfoHelper.getStepName(farmClub.getVeggieInfoId(), 0); UserFarmClub userFarmClub = createUserFarmClubEntity(userId, stepName, farmClub, myVeggie); farmClub.addUserFarmClub(userFarmClub); myVeggie.setUserFarmClub(userFarmClub); From f7632219c490fa51bb11c37f550c93d1a479c7fb Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Wed, 3 Jul 2024 09:47:48 +0900 Subject: [PATCH 8/8] =?UTF-8?q?[fix]=20=EB=82=B4=20=ED=8C=9C=ED=81=B4?= =?UTF-8?q?=EB=9F=BD=20=EC=A1=B0=ED=9A=8C=20=EC=8B=9C=20=ED=99=9C=EB=8F=99?= =?UTF-8?q?=EC=9D=BC=EC=88=98=20=EC=9D=B4=EC=83=81=ED=95=9C=EA=B1=B0=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/farmclub/dto/res/GetMyFarmClubResponseDto.java | 2 +- .../farmusspring/domain/farmclub/vo/GetMyFarmClubVo.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetMyFarmClubResponseDto.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetMyFarmClubResponseDto.java index 7a222800..cf31e153 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetMyFarmClubResponseDto.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetMyFarmClubResponseDto.java @@ -15,7 +15,7 @@ public record GetMyFarmClubResponseDto( Long wholeMemberCount, List steps, String advice, - int daysSinceStart + Long daysSinceStart ) { public static GetMyFarmClubResponseDto of(GetMyFarmClubVo farmClubInfo, List steps, String advice) { diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/vo/GetMyFarmClubVo.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/vo/GetMyFarmClubVo.java index 66960845..fee9fa37 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/vo/GetMyFarmClubVo.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/vo/GetMyFarmClubVo.java @@ -5,6 +5,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; public record GetMyFarmClubVo( @@ -12,7 +13,7 @@ public record GetMyFarmClubVo( String farmClubImage, String veggieInfoId, Long wholeMemberCount, - Integer daySinceStart + Long daySinceStart ) { public static GetMyFarmClubVo of(BaseInfo baseInfo, Long wholeMemberCount, LocalDate dayRegister) { return new GetMyFarmClubVo( @@ -20,7 +21,7 @@ public static GetMyFarmClubVo of(BaseInfo baseInfo, Long wholeMemberCount, Local baseInfo.farmClubImage(), baseInfo.veggieInfoId(), wholeMemberCount, - LocalDate.now().compareTo(dayRegister) + ChronoUnit.DAYS.between(dayRegister, LocalDate.now()) ); }