• Delete product handler

    Parameters

    • productService: ProductDataService

      injected service use to handle the catalog related operations

    • productVariantService: ProductVariantDataService
    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

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

      • params.productId is required

    Returns Promise<adapter.AdapterHandlerResponse>

    204 Status No Content

    Description

    This handler is used to delete a product by applying the following steps in sequence:

    1. Get the productId from params

    2. Check if the product exists (productService.isProductExists)

    3. Delete the product (productService.deleteProduct)

    4. Return 204

    Throws

    Error

    • productId is missing from path

    Throws

    404 NBError Not Found

    • Product ${productId} not found

    Throws

    500 NBError Internal Server Error

    • Error happen when delete product ${productId} from database

Generated using TypeDoc