Skip to content

ProductsModule.Class.ProductReviewService

tgreyuk edited this page Apr 25, 2024 · 1 revision

github-wiki-example / ProductsModule / ProductReviewService

Class: ProductReviewService

Service for managing product reviews.

Constructors

new ProductReviewService()

new ProductReviewService(): ProductReviewService

Returns

ProductReviewService

Properties

Property Modifier Type Default value
reviews private ProductReview[] []

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.

Source

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.

Source

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.

Source

products.ts:169

Clone this wiki locally