Skip to content

Commit

Permalink
Merge pull request #137 from Mojacknong/fix_136/채소-리스트-API
Browse files Browse the repository at this point in the history
[fix] 채소 리스트 조회 시 userFarmCludId -> farmCludId  변경
  • Loading branch information
Ryeolee authored Sep 26, 2024
2 parents 5f67749 + 1154d8c commit 4dac360
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class SelectMyVeggieListResponse {
// List<SelectMyVeggieListDto> simpleMyVeggieList;
public Long myVeggieId;
public String nickname;
public int userFarmClubId;
public Long farmClubId;


}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public BaseResponseDto<List<SelectMyVeggieListResponse>> selectMyVeggieList(Long

public List<SelectMyVeggieListResponse> processSimpleVeggieData(List<MyVeggie> 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();
}

Expand All @@ -83,7 +83,7 @@ public BaseResponseDto<SelectMyVeggieProfileResponse> selectMyVeggieProfile(Long
myVeggie.getVeggieImage(),
DateManager.parsingDotDate(myVeggie.getBirth()),
DateManager.calculateDay(myVeggie.getBirth(), new Date()),
checkFarmClubAffiliation(myVeggie),
checkFarmClubAffiliationAndCurrentStop(myVeggie),
veggieInfo.getSteps().size()
));
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4dac360

Please sign in to comment.