• Does category exist validator

    Parameters

    • categoryIdFieldInfo: TargetField

      which field to get the categoryId from context

    • categoryService: CategoryDataService

      category service

    • logger: Logger

      injected logger used to handle the logging

    • context: AdapterHandlerContext

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

    Returns Promise<number>

    200 Status Ok

    Description

    This validator is used to check if the category exists by applying the following steps in sequence:

    1. Get the categoryId from the context

    2. Check if the categoryId is null

    3. Check if the category is exist

    Throws

    400 NBError Wrong parameter

    • categoryId is missing in categoryIdFieldInfo.type, categoryIdFieldInfo.name

    Throws

    404 NBError Not found

    • category not found: categoryId

Generated using TypeDoc