From 1c64182cf84be8ffac98b53a7c4f2665963a6821 Mon Sep 17 00:00:00 2001 From: seungryeol Date: Sat, 14 Sep 2024 15:57:40 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=EC=8B=AC=ED=94=8C=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20api=EC=9D=98=20userFarmCludId=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/response/SelectMyVeggieListResponse.java | 1 + .../myveggiegarden/service/MyVeggieGardenService.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/response/SelectMyVeggieListResponse.java b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/response/SelectMyVeggieListResponse.java index ed61d014..b893d1b8 100644 --- a/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/response/SelectMyVeggieListResponse.java +++ b/src/main/java/com/modernfarmer/farmusspring/domain/myveggiegarden/dto/response/SelectMyVeggieListResponse.java @@ -15,6 +15,7 @@ public class SelectMyVeggieListResponse { // List simpleMyVeggieList; public Long myVeggieId; public String nickname; + public int userFarmClubId; } 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 7bd71b03..d999a97e 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 @@ -54,10 +54,18 @@ public BaseResponseDto settingMyVeggie(Long userId, SettingMyVeggieRequest se @Transactional public BaseResponseDto> selectMyVeggieList(Long userId) { List myVeggieList = bringMyVeggieData(userId); - List selectMyVeggieLists = SelectMyVeggieListDto.processData(myVeggieList); + List selectMyVeggieLists = processSimpleVeggieData(myVeggieList); return BaseResponseDto.of(SuccessCode.SUCCESS,selectMyVeggieLists); } + public List processSimpleVeggieData(List myVeggieList){ + return myVeggieList.stream() + .map(myVeggie -> SelectMyVeggieListResponse.of(myVeggie.getId(),myVeggie.getNickname(), checkFarmClubAffiliation(myVeggie))) + .toList(); + } + + + @Transactional public BaseResponseDto deleteMyVeggie(DeleteMyVeggieRequest deleteMyVeggieRequest) { deleteMyVeggieById((deleteMyVeggieRequest.getMyVeggieId())); @@ -83,7 +91,6 @@ public BaseResponseDto selectMyVeggieProfile(Long @Transactional public BaseResponseDto> selectDetailMyVeggieList(Long userId) { - List myVeggieList = bringMyVeggieData(userId); List selectMyVeggieList = myDetailMyVeggieDto.processData(myVeggieList); return BaseResponseDto.of(SuccessCode.SUCCESS,selectMyVeggieList);