@webshop/root - v1.0.0
    Preparing search index...

    Service responsible for handling game review logic.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    databaseService: DatabaseService = ...

    Methods

    • Retrieves all reviews for a given game, sorted by most recent.

      Parameters

      • gameSKU: string

        The SKU of the game to retrieve reviews for.

      Returns Promise<IReview[]>

      A list of reviews sorted by creation date descending.

    • Checks whether the user has already reviewed the given game. Each user may only submit one review per purchased game.

      Parameters

      • userId: number

        The ID of the user to check.

      • gameSKU: string

        The SKU of the game to check.

      Returns Promise<boolean>

      True if the user has already reviewed the game, false otherwise.

    • Checks whether the user has purchased the given game. A user can only review a game they have bought.

      TODO: Uncomment the real implementation below once an order flow has been implemented. The order_item and order tables need to exist and be populated for this to work.

      Parameters

      • _userId: number

        The ID of the user to check.

      • _gameSKU: string

        The SKU of the game to check.

      Returns Promise<boolean>

      Always true until an order flow is implemented.

    • Submits a review for a game by the logged-in user.

      Parameters

      • userId: number

        The ID of the user submitting the review.

      • gameSKU: string

        The SKU of the game being reviewed.

      • rating: number

        Star rating between 1 and 5.

      • reviewText: string

        The written review text.

      Returns Promise<void>