• Duplicate 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>

    201 Status Created

    • data: copied product

    Description

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

    1. Get the productId from params

    2. Copy the product (productService.copyProduct)

    3. Get the copied product (productService.getOneProductByIdAndAggregate)

    4. Return the copied product

    Throws

    Error

    • productId is missing from path

    Throws

    404 NBError Not Found

    • product with id: ${productId} not found

    Throws

    500 NBError Internal Server Error

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

Generated using TypeDoc