From b78424b6fec6ee843b5132538832ef09ba537a3f Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Mon, 27 May 2024 01:09:01 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=EC=B1=84=EC=86=8C=20=EC=A0=95=EB=B3=B4?= =?UTF-8?q?=EC=9D=98=20help=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80,=20=EA=B8=B0=EC=A1=B4=20=EB=AC=B8=EC=9E=90=EC=97=B4?= =?UTF-8?q?=20=EB=B0=B0=EC=97=B4=EC=97=90=EC=84=9C=20json=20=ED=83=80?= =?UTF-8?q?=EC=9E=85=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../farmclub/dto/res/GetFarmClubResponseDto.java | 5 +++-- .../domain/farmclub/service/FarmClubService.java | 3 ++- .../domain/veggieinfo/entity/VeggieInfo.java | 12 +++++++++++- .../domain/veggieinfo/helper/VeggieInfoHelper.java | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetFarmClubResponseDto.java b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetFarmClubResponseDto.java index b010e7b8..394e609b 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetFarmClubResponseDto.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/farmclub/dto/res/GetFarmClubResponseDto.java @@ -1,6 +1,7 @@ package com.modernfarmer.farmusspring.domain.farmclub.dto.res; import com.modernfarmer.farmusspring.domain.farmclub.entity.FarmClub; +import com.modernfarmer.farmusspring.domain.veggieinfo.entity.VeggieInfo; import lombok.Builder; import java.util.List; @@ -15,9 +16,9 @@ public record GetFarmClubResponseDto ( String startedAt, int maxMemberCount, int currentMemberCount, - List help + VeggieInfo.Help help ){ - public static GetFarmClubResponseDto of(FarmClub farmClub, int currentMemberCount, List help) { + public static GetFarmClubResponseDto of(FarmClub farmClub, int currentMemberCount, VeggieInfo.Help help) { return GetFarmClubResponseDto.builder() .farmClubId(farmClub.getId()) .farmClubName(farmClub.getName()) 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 d3bbcff8..d281f38c 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 @@ -11,6 +11,7 @@ import com.modernfarmer.farmusspring.domain.farmclub.vo.GetMyFarmClubVo; import com.modernfarmer.farmusspring.domain.myveggiegarden.entity.MyVeggie; import com.modernfarmer.farmusspring.domain.myveggiegarden.helper.MyVeggieHelper; +import com.modernfarmer.farmusspring.domain.veggieinfo.entity.VeggieInfo; import com.modernfarmer.farmusspring.domain.veggieinfo.vo.CreateFarmClubVo; import com.modernfarmer.farmusspring.domain.veggieinfo.helper.VeggieInfoHelper; import com.modernfarmer.farmusspring.domain.veggieinfo.vo.StepVo; @@ -49,7 +50,7 @@ public CreateFarmClubResponseDto createFarmClub(CreateFarmClubRequestDto request public GetFarmClubResponseDto getFarmClub(Long id) { FarmClub farmClub = farmClubHelper.getFarmClubEntity(id); - List help = veggieInfoHelper.getVeggieInfoHelp(farmClub.getVeggieInfoId()); + VeggieInfo.Help help = veggieInfoHelper.getVeggieInfoHelp(farmClub.getVeggieInfoId()); return GetFarmClubResponseDto.of(farmClub, farmClub.getUserFarmClubs().size(), help); } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/veggieinfo/entity/VeggieInfo.java b/src/main/java/com/modernfarmer/farmusspring/domain/veggieinfo/entity/VeggieInfo.java index 93e39870..8064655e 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/veggieinfo/entity/VeggieInfo.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/veggieinfo/entity/VeggieInfo.java @@ -34,7 +34,7 @@ public class VeggieInfo extends BaseDocument { private String period; - private List help; + private Help help; @AllArgsConstructor @NoArgsConstructor @@ -48,6 +48,16 @@ public static class Step { private List tips; } + @AllArgsConstructor + @NoArgsConstructor + @Getter + @Builder + public static class Help { + private String material; + private List selectHow; + private List features; + } + public static VeggieInfo createVeggieInfo(String name, String difficulty, List steps, String veggieImage) { return VeggieInfo.builder() .name(name) 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 7bc117fb..819b8084 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 @@ -19,7 +19,7 @@ public class VeggieInfoHelper { private final VeggieInfoRepository veggieInfoRepository; - public List getVeggieInfoHelp(String veggieInfoId) { + public VeggieInfo.Help getVeggieInfoHelp(String veggieInfoId) { VeggieInfo veggieInfo = veggieInfoRepository.findById(new ObjectId(veggieInfoId)) .orElseThrow(() -> new VeggieInfoNotFoundException("존재하지 않는 채소 정보 아이디입니다."));