From 078e6d0dbb3f50f234a319ccd08f54850c66259e Mon Sep 17 00:00:00 2001 From: MinchoGreenT Date: Mon, 27 May 2024 00:58:48 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=EB=82=B4=20=EC=B1=84=EC=86=8C=EC=9D=98?= =?UTF-8?q?=20veggieInfoId=20String=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 --- .../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);