Skip to content

Commit

Permalink
refactor: DetailProductRecipeDto에 상품 평점 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Go-Jaecheol committed Apr 7, 2024
1 parent f15f211 commit 667834d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/java/com/funeat/recipe/dto/DetailProductRecipeDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@ public class DetailProductRecipeDto {
private final String name;
private final Long price;
private final String image;
private final Double averageRating;

private DetailProductRecipeDto(final Long id, final String name, final Long price, final String image) {
private DetailProductRecipeDto(final Long id, final String name, final Long price, final String image,
final Double averageRating) {
this.id = id;
this.name = name;
this.price = price;
this.image = image;
this.averageRating = averageRating;
}

public static DetailProductRecipeDto toDto(final Product product) {
return new DetailProductRecipeDto(product.getId(), product.getName(), product.getPrice(), product.getImage());
return new DetailProductRecipeDto(product.getId(), product.getName(), product.getPrice(), product.getImage(),
product.getAverageRating());
}

public Long getId() {
Expand All @@ -35,4 +39,8 @@ public Long getPrice() {
public String getImage() {
return image;
}

public Double getAverageRating() {
return averageRating;
}
}

0 comments on commit 667834d

Please sign in to comment.