Skip to main content

ProductReviewService

Service for managing product reviews.

Constructors

new ProductReviewService()

new ProductReviewService(): ProductReviewService

Returns

ProductReviewService

Methods

addProductReview()

addProductReview(review): ProductReview

Add a new product review.

Parameters

ParameterTypeDescription
reviewProductReviewThe product review to be added.

Returns

ProductReview

The added product review.


getAverageRating()

getAverageRating(productId): number

Get the average rating for a specific product.

Parameters

ParameterTypeDescription
productIdstringThe 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

ParameterTypeDescription
productIdstringThe ID of the product.

Returns

ProductReview[]

An array of product reviews for the specified product.