• Review belongs to organization validator

    Parameters

    • reviewService: Pick<ReviewDataService, "getOneReviewById">

      injected review data service

    • organizationIdTarget: TargetField

      target field to get the organization id

    • reviewIdTarget: TargetField

      target field to get the review id

    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

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

    Returns Promise<util.StatusCodes>

    200 Status OK

    Description

    This validator is used to check if the review belongs to the organization by applying the following steps in sequence:

    1. Get the reviewId from context

    2. Check if the review source is organization

    3. Get organizationId from context

    4. Check if reviewedBy id is the same as organization ID

    5. Return the status code

    Throws

    400 NBError Bad Request

    • Review source is not for organization

    Throws

    403 NBError Forbidden

    • Review does not belong to organization

Generated using TypeDoc