From 078e6d0dbb3f50f234a319ccd08f54850c66259e Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Mon, 27 May 2024 00:58:48 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[fix]=20=EB=82=B4=20=EC=B1=84=EC=86=8C?= =?UTF-8?q?=EC=9D=98=20veggieInfoId=20String=EC=9C=BC=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MyVeggieGardenController.java | 4 ++-- .../dto/request/SettingMyVeggieRequest.java | 4 ++-- .../dto/response/SelectMyVeggieListDto.java | 2 +- .../domain/myveggiegarden/entity/MyVeggie.java | 4 ++-- .../service/MyVeggieGardenService.java | 12 ++++++------ 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/MyVeggieGardenController.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/MyVeggieGardenController.java index 67e334da..bc613fd1 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/MyVeggieGardenController.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/controller/MyVeggieGardenController.java @@ -31,11 +31,11 @@ public class MyVeggieGardenController { @PostMapping(value = "") public BaseResponseDto settingMyVeggie( @AuthenticationPrincipal CustomUser user, - @Validated @RequestBody SettingMyVeggieRequest settingMyVeggi + @Validated @RequestBody SettingMyVeggieRequest settingMyVeggie ){ return myVeggieGardenService.settingMyVeggie( user.getUserId(), - settingMyVeggi + settingMyVeggie ); } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/request/SettingMyVeggieRequest.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/request/SettingMyVeggieRequest.java index 2b6f5fc5..0a984ce4 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/request/SettingMyVeggieRequest.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/request/SettingMyVeggieRequest.java @@ -17,10 +17,10 @@ public class SettingMyVeggieRequest { private String nickname; @NotNull(message = "null 값을 가지면 안됩니다.") - private Date birh; + private Date birth; @NotNull(message = "null 값을 가지면 안됩니다.") - private Long veggiInfoId; + private String veggieInfoId; @NotNull(message = "null 값을 가지면 안됩니다.") private String veggieName; diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/response/SelectMyVeggieListDto.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/response/SelectMyVeggieListDto.java index ec95b0ac..cd9e3fff 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/response/SelectMyVeggieListDto.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/response/SelectMyVeggieListDto.java @@ -16,7 +16,7 @@ public class SelectMyVeggieListDto { public static List processData(List myVeggieList){ return myVeggieList.stream() - .map(myVeggie -> SelectMyVeggieListResponse.of(myVeggie.getVeggieInfoId(),myVeggie.getNickname())) + .map(myVeggie -> SelectMyVeggieListResponse.of(myVeggie.getId(),myVeggie.getNickname())) .toList(); } } diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/MyVeggie.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/MyVeggie.java index 606d2204..84cf9e67 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/MyVeggie.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/entity/MyVeggie.java @@ -33,7 +33,7 @@ public class MyVeggie extends BaseEntity { private Date birth; @Column(name = "veggie_info_id") - private Long veggieInfoId; + private String veggieInfoId; @Column(name = "veggie_name") private String veggieName; @@ -58,7 +58,7 @@ public class MyVeggie extends BaseEntity { @JoinColumn(name = "user_farm_club_id") private UserFarmClub userFarmClub; - public static MyVeggie createMyVegetable(String nickname, Date birth, Long veggieInfoId, + public static MyVeggie createMyVegetable(String nickname, Date birth, String veggieInfoId, String veggieName, String veggieImage, User user){ diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/MyVeggieGardenService.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/MyVeggieGardenService.java index b723b90e..e83a9d4d 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/MyVeggieGardenService.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/service/MyVeggieGardenService.java @@ -109,14 +109,14 @@ public MyVeggie getMyVeggie(Long userId){ .orElseThrow(() -> new IllegalArgumentException("채소가 존재하지 않습니다.")); } - private void addMyyVeggie(Long userId, SettingMyVeggieRequest settingMyVeggiRequest){ + private void addMyyVeggie(Long userId, SettingMyVeggieRequest settingMyVeggieRequest){ MyVeggie newMyVeggie = MyVeggie.createMyVegetable( - settingMyVeggiRequest.getNickname(), - settingMyVeggiRequest.getBirh(), - settingMyVeggiRequest.getVeggiInfoId(), - settingMyVeggiRequest.getVeggieName(), - settingMyVeggiRequest.getVeggieImage(), + settingMyVeggieRequest.getNickname(), + settingMyVeggieRequest.getBirth(), + settingMyVeggieRequest.getVeggieInfoId(), + settingMyVeggieRequest.getVeggieName(), + settingMyVeggieRequest.getVeggieImage(), User.builder().id(userId).build() ); myVeggieRepository.save(newMyVeggie); From b78424b6fec6ee843b5132538832ef09ba537a3f Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Mon, 27 May 2024 01:09:01 +0900 Subject: [PATCH 2/2] =?UTF-8?q?[fix]=20=EC=B1=84=EC=86=8C=20=EC=A0=95?= =?UTF-8?q?=EB=B3=B4=EC=9D=98=20help=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80,=20=EA=B8=B0=EC=A1=B4=20=EB=AC=B8=EC=9E=90?= =?UTF-8?q?=EC=97=B4=20=EB=B0=B0=EC=97=B4=EC=97=90=EC=84=9C=20json=20?= =?UTF-8?q?=ED=83=80=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("존재하지 않는 채소 정보 아이디입니다."));