• Create 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].

    Returns Promise<adapter.AdapterHandlerResponse>

    201 Status Created

    • data: created product

    Description

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

    1. Get the orgId from params

    2. Create a product (productService.createProduct)

    3. Get the created product (productService.getOneProductByIdAndAggregate)

    4. Return the created product

    Throws

    Error

    • orgId is missing from path

    Throws

    500 NBError Internal Server Error

    • Error happen when create product from database

Generated using TypeDoc