ProductReviewService
Service for managing product reviews.
Constructors
new ProductReviewService()
new ProductReviewService(): ProductReviewService
Returns
Methods
addProductReview()
addProductReview(review): ProductReview
Add a new product review.
Parameters
Parameter | Type | Description |
---|---|---|
review | ProductReview | The product review to be added. |
Returns
The added product review.
getAverageRating()
getAverageRating(productId): number
Get the average rating for a specific product.
Parameters
Parameter | Type | Description |
---|---|---|
productId | string | The ID of the product. |
Returns
number
The average rating for the specified product.
getProductReviews()
getProductReviews(productId): ProductReview[]
Get all product reviews for a specific product.
Parameters
Parameter | Type | Description |
---|---|---|
productId | string | The ID of the product. |
Returns
An array of product reviews for the specified product.