feat(medusa): allow category list api to be filtered by handle (#3825)
what: - Introduce a filter to the list endpoint to query by handle why: - Storefronts mostly interact through handles and not IDs for readability and seo purposes - Take an example of a url `site.com/category/mens-wear` RESOLVES CORE-1325
This commit is contained in:
@@ -13,7 +13,8 @@ import { optionalBooleanMapper } from "../../../../utils/validators/is-boolean"
|
||||
* description: "Retrieve a list of product categories."
|
||||
* x-authenticated: true
|
||||
* parameters:
|
||||
* - (query) q {string} Query used for searching product category names orhandles.
|
||||
* - (query) q {string} Query used for searching product category names or handles.
|
||||
* - (query) handle {string} Query used for searching product category by handle.
|
||||
* - (query) is_internal {boolean} Search for only internal categories.
|
||||
* - (query) is_active {boolean} Search for only active categories
|
||||
* - (query) include_descendants_tree {boolean} Include all nested descendants of category
|
||||
@@ -94,6 +95,10 @@ export class AdminGetProductCategoriesParams extends extendedFindParamsMixin({
|
||||
@IsOptional()
|
||||
q?: string
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
handle?: string
|
||||
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@Transform(({ value }) => optionalBooleanMapper.get(value))
|
||||
|
||||
@@ -15,6 +15,7 @@ import { defaultStoreCategoryScope } from "."
|
||||
* x-authenticated: false
|
||||
* parameters:
|
||||
* - (query) q {string} Query used for searching product category names or handles.
|
||||
* - (query) handle {string} Query used for searching product category by handle.
|
||||
* - (query) parent_category_id {string} Returns categories scoped by parent
|
||||
* - (query) include_descendants_tree {boolean} Include all nested descendants of category
|
||||
* - (query) offset=0 {integer} How many product categories to skip in the result.
|
||||
@@ -96,6 +97,10 @@ export class StoreGetProductCategoriesParams extends extendedFindParamsMixin({
|
||||
@IsOptional()
|
||||
q?: string
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
handle?: string
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@Transform(({ value }) => {
|
||||
|
||||
Reference in New Issue
Block a user