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

[feature/7-desserts-getDessert] 상품 상세 조회 API에 디자인 요금 추가 #170

Merged
merged 2 commits into from
Mar 9, 2023
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 @@ -16,6 +16,7 @@ public class GetDessertRes {
private Integer dessertPrice;
private String dessertDescription;
private List<Image> images;
private List<OptionDTO> options;

@Getter
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
@AllArgsConstructor
@NoArgsConstructor
public class OptionDTO {
private String optionDescription;
private Integer optionPrice;
private String optionDescription;
private Integer optionPrice;
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,10 @@ public GetDessertRes getDessert(Long dessertIdx) throws BaseException {
ArrayList<GetDessertRes.Image> postImgList = getPostImgList(dessert);
imgList.addAll(postImgList);

// nickname, dessertName, dessertPrice, dessertDescription, imgList(상품 상세 이미지 1장+피드 이미지 4장)
return new GetDessertRes(dessert.getStore().getUser().getNickname(), dessert.getDessertName(), dessert.getDessertPrice(), dessert.getDessertDescription(), imgList);
List<OptionDTO> optionList = getOptionList(dessert);

// nickname, dessertName, dessertPrice, dessertDescription, imgList(상품 상세 이미지 1장, 피드 이미지 4장), optionList(description, price)
return new GetDessertRes(dessert.getStore().getUser().getNickname(), dessert.getDessertName(), dessert.getDessertPrice(), dessert.getDessertDescription(), imgList, optionList);
} catch (BaseException e) {
throw e;
} catch (Exception e) {
Expand All @@ -113,10 +115,10 @@ private String representPostImgUrl(List<PostImg> postImages){
return postImages.isEmpty() ? null : postImages.get(0).getImgUrl();
}

// private List<GetDessertRes.Option> getOptionList(Dessert dessert) {
// return optionRepository.findByDessertAndStatusOrderByOptionIdx(dessert, ACTIVE_STATUS).stream()
// .map(option -> new GetDessertRes.Option(option.getDescription(), option.getPrice())).collect(Collectors.toList());
// }
private List<OptionDTO> getOptionList(Dessert dessert) {
return optionRepository.findByDessertAndStatusOrderByOptionIdx(dessert, ACTIVE_STATUS).stream()
.map(option -> new OptionDTO(option.getDescription(), option.getPrice())).collect(Collectors.toList());
}

/**
* [판매자] 상품 등록
Expand Down