• Is my review validator

    Parameters

    • authSecrets: AuthSecrets

      authentication secrets

    • authenticate: AuthenticationFunction

      injected function use to authenticate the user token

    • targetField: TargetField

      target field to get the review id

    • reviewService: ReviewDataService

      injected service use to handle the review related operations

      • getOneReviewById
    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

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

    Returns Promise<number>

    200 Status OK

    Description

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

    1. Get the reviewId from params

    2. Authenticate the request

    3. Get the review by reviewId (reviewService.getOneReviewById)

    4. Check if the review is created by the user

    5. Return the status code

    Throws

    400 NBError Bad Request

    • cannot found parameter in ${targetField.type} ${targetField.name}

    Throws

    401 NBError Unauthorized

    • failed when authenticate

    Throws

    403 NBError Forbidden

    • user id is not same to request user id

Generated using TypeDoc