• Get category tree handler

    Parameters

    • categoryService: Pick<CategoryDataService, "getCategoryTree" | "normalizeCategoryTreeResponses">

      injected service use to handle the category related operations

    • paginationConfiguration: PaginationConfigurations

      injected pagination configuration

    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

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

    Returns Promise<adapter.AdapterHandlerResponse>

    200 Status Ok

    • data: category tree

    Description

    This handler is used to get a tree of categories by applying the following steps in sequence:

    1. Parse the query to get the pagination options (util.parsePaginatedListQuery)

    2. Check if the pagination options are valid

    3. Get the category tree (categoryService.getCategoryTree)

    4. Normalize the category tree response (normalizeCategoryTreeResponse)

    5. Return the normalize category tree response

    Throws

    Error

    • query is not exist

    Throws

    400 NBError Bad Request

    • error when parse paginated list query, ${error.message}
    • pagination must be set
    • Page size exceeds ${MAXIMUM_PAGE_SIZE} mbs

    Throws

    500 NBError Internal Server Error

    • Error happen when get category tree from database

Generated using TypeDoc