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 b893d1b..cc7d89a 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,7 +15,7 @@ public class SelectMyVeggieListResponse { // List simpleMyVeggieList; public Long myVeggieId; public String nickname; - public int userFarmClubId; + public Long farmClubId; } 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 d999a97..84007d5 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 @@ -60,7 +60,7 @@ public BaseResponseDto> selectMyVeggieList(Long public List processSimpleVeggieData(List myVeggieList){ return myVeggieList.stream() - .map(myVeggie -> SelectMyVeggieListResponse.of(myVeggie.getId(),myVeggie.getNickname(), checkFarmClubAffiliation(myVeggie))) + .map(myVeggie -> SelectMyVeggieListResponse.of(myVeggie.getId(),myVeggie.getNickname(), checkFarmClubAffiliationAndFarmClubId(myVeggie))) .toList(); } @@ -83,7 +83,7 @@ public BaseResponseDto selectMyVeggieProfile(Long myVeggie.getVeggieImage(), DateManager.parsingDotDate(myVeggie.getBirth()), DateManager.calculateDay(myVeggie.getBirth(), new Date()), - checkFarmClubAffiliation(myVeggie), + checkFarmClubAffiliationAndCurrentStop(myVeggie), veggieInfo.getSteps().size() )); } @@ -113,12 +113,18 @@ public void successFarming(SuccessFarmingRequestDto requestDto, MultipartFile im myVeggieHelper.deleteMyVeggie(requestDto.myVeggieId()); } - public int checkFarmClubAffiliation(MyVeggie myVeggie){ + public int checkFarmClubAffiliationAndCurrentStop(MyVeggie myVeggie){ if(myVeggie.getUserFarmClub() == null || myVeggie.getUserFarmClub().isComplete()) return -1; return myVeggie.getUserFarmClub().getCurrentStep(); } + public Long checkFarmClubAffiliationAndFarmClubId(MyVeggie myVeggie){ + if(myVeggie.getUserFarmClub() == null || myVeggie.getUserFarmClub().isComplete()) + return (long) -1; + return myVeggie.getUserFarmClub().getFarmClub().getId(); + } + public MyVeggie selectMyVeggieAndFarmClub(Long myVeggieId){ return myVeggieRepository.findMyVeggieAndFarmClub(myVeggieId);