• Create user review by org handler

    Parameters

    • reviewService: Pick<ReviewDataService, "calculateStatisticsForTarget" | "createReview" | "getOneReviewById">

      injected service use to handle the review related operations

      • createReview
    • userApi: Pick<UserDefaultAdapterAPI, "updateUserReviewStats">
    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

      request context [headers, body, params, query].

      • params.userId is required

    Returns Promise<adapter.AdapterHandlerResponse>

    201 Status Created

    Description

    This handler is used to create one user review by org by applying the following steps in sequence:

    1. Get the userId from params

    2. Create review where targetId is userId (reviewService.createReview)

    3. Recalculate user stats (userApi.updateUserReviewStats) If an error occurs, it is logged and the process continues

    4. Return the created review

    Throws

    400 NBError Bad Request

    • userId is missing in request params

    Throws

    500 NBError Internal Server Error

    • create review failed

Generated using TypeDoc