Skip to content

Commit

Permalink
Merge pull request #61 from nowgnas/fix/product-status-enum
Browse files Browse the repository at this point in the history
🐛 Amend product list and detail
  • Loading branch information
nowgnas authored Dec 29, 2023
2 parents 1ffcddb + 9ae4862 commit 626fd7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ public static class ProductListItem {
private Long salesCount;
private Long reviewCount;
private Long averageRating;
private ProductSaleStatus productSaleStatus;

public static List<String> getProductIds(List<ProductListItem> productListItem) {
return productListItem.stream().map(ProductListItem::getKey).collect(Collectors.toList());
Expand Down Expand Up @@ -390,7 +391,7 @@ public static class StoreProductDetail {
private String productDescriptionImage;
private Long productSaleAmount;
private Double averageRating;
private String productSaleStatus;
private ProductSaleStatus productSaleStatus;
private ProductDetailFlower representativeFlower;
private List<ProductDetailFlower> flowers;

Expand Down Expand Up @@ -422,7 +423,7 @@ public static StoreProductDetail fromEntity(Product product, List<Flower> flower
.productDescriptionImage(product.getProductDescriptionImage())
.productSaleAmount(product.getProductSaleAmount())
.averageRating(product.getAverageRating())
.productSaleStatus(product.getProductSaleStatus().getMessage())
.productSaleStatus(product.getProductSaleStatus())
.representativeFlower(representativeFlower)
.flowers(flowerList)
.build();
Expand All @@ -440,7 +441,7 @@ public static class StoreProduct {
private Long productPrice;
private Long productSaleAmount;
private Double averageRating;
private String productSaleStatus;
private ProductSaleStatus productSaleStatus;

public static StoreProduct fromEntity(Product product, String representativeFlower) {
return StoreProduct.builder()
Expand All @@ -450,7 +451,7 @@ public static StoreProduct fromEntity(Product product, String representativeFlow
.productName(product.getProductName())
.productPrice(product.getProductPrice())
.productSaleAmount(product.getProductSaleAmount())
.productSaleStatus(product.getProductSaleStatus().getMessage())
.productSaleStatus(product.getProductSaleStatus())
.productThumbnail(product.getProductThumbnail())
.representativeFlower(representativeFlower)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ List<ProductFlowers> flowerRequestToFlowersList(
@Mapping(target = "productPrice", source = "product.productPrice"),
@Mapping(target = "reviewCount", source = "product.reviewCount"),
@Mapping(target = "averageRating", source = "product.averageRating"),
@Mapping(target = "productSaleStatus", source = "product.productSaleStatus"),
})
ProductListItem entityToListItem(Product product);

Expand Down

0 comments on commit 626fd7d

Please sign in to comment.