Skip to content

products.Class.ProductReviewService

tgreyuk edited this page Sep 6, 2024 · 6 revisions

github-wiki-example / products / ProductReviewService

Class: 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

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

Returns

ProductReview

The added product review.

Defined in

products.ts:159


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.

Defined in

products.ts:178


getProductReviews()

getProductReviews(productId): ProductReview[]

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.

Defined in

products.ts:169

Clone this wiki locally