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 ed61d01..b893d1b 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 7bd71b0..d999a97 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);