Skip to content

products.Class.ProductReviewService

tgreyuk edited this page Mar 23, 2025 · 8 revisions

github-wiki-example / products / ProductReviewService

Class: ProductReviewService

Defined in: products.ts:151

Service for managing product reviews.

Constructors

Constructor

new ProductReviewService(): ProductReviewService

Returns

ProductReviewService

Methods

addProductReview()

addProductReview(review): ProductReview

Defined in: products.ts:159

Add a new product review.

Parameters

Parameter Type Description
review ProductReview The product review to be added.

Returns

ProductReview

The added product review.


getAverageRating()

getAverageRating(productId): number

Defined in: products.ts:178

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[]

Defined in: products.ts:169

Get all product reviews for a specific product.

Parameters

Parameter Type Description
productId string The ID of the product.

Returns

ProductReview[]

An array of product reviews for the specified product.

Clone this wiki locally