• Update category handler

    Parameters

    • categoryService: Pick<CategoryDataService, "getCategory" | "normalizeCategoryResponse" | "updateCategory">

      injected service use to handle the category related operations

    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

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

      • params.id is required

    Returns Promise<adapter.AdapterHandlerResponse>

    200 Status Ok

    • data: updated category

    Description

    This handler is used to update a category by applying the following steps in sequence:

    1. Get the categoryId from params

    2. Update the category (categoryService.updateCategory)

    3. Get the updated category (categoryService.getOneCategory)

    4. Return the updated category (categoryService.normalizeCategoryResponse)

    Throws

    Error

    • id is missing from path

    Throws

    404 NBError Not Found

    • Category ${id} not found

    Throws

    500 NBError Internal Server Error

    • Error happen when update category ${id} from database

Generated using TypeDoc