Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] 채소 리스트 조회 시 userFarmCludId -> farmCludId 변경 #137

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading