• Is product exist validator

    Parameters

    • productIdFieldInfo: TargetField

      which field to get the productId from context

    • productService: ProductDataService

      product service

    • 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 product is exist by applying the following steps in sequence:

    1. Get the productId from the context

    2. Check if the productId is null

    3. Check if the product is exist

    Throws

    400 NBError Wrong parameter

    • productId is missing in productIdFieldInfo.type, productIdFieldInfo.name

    Throws

    404 NBError Not found

    • product not found: productId

Generated using TypeDoc