FeedbackService

Source: FeedbackService.js:18

Service for handling user feedback. Manages feedback submission, retrieval, and processing.


Constructor

new FeedbackService(): FeedbackService

Instance Methods

create( stars: number, text: string, actingUserId: UUID, ): Promise.<Feedback>

Create a new Feedback

Parameters

  • stars (number) — Number of stars given in the feedback.
  • text (string) — Text content of the feedback.
  • actingUserId (UUID) — ID of the user submitting the feedback.

Returns

  • Promise.<Feedback> — The created feedback object.

getAll( ownerIds: Array.<UUID>, actingUserId: UUID, ): Promise.<Array.<Feedback>>

Get all Feedbacks

Parameters

  • ownerIds (Array.<UUID>) — IDs of the owners whose feedbacks are to be retrieved.
  • actingUserId (UUID) — ID of the acting user.

Returns

  • Promise.<Array.<Feedback>> — List of feedbacks for the user.

getNewest(): Promise.<Feedback>

Get newest Feedback

Returns

  • Promise.<Feedback> — The most recently created feedback.

getTotalAverage(): Promise.<number>

Get the average stars of all Feedbacks

Returns

  • Promise.<number> — The average rating of all feedbacks.

getAverageOfLastMonth(): Promise.<number>

Get the average stars of all Feedbacks in the last month

Returns

  • Promise.<number> — The average rating of feedbacks from the last month.