feat(medusa): category list API can return all descendant (#3392)

* chore: category list API can return all descendant

* chore: category handle is no longer required via api

* chore: added treescope to sorting

* chore: address feedback on PR
This commit is contained in:
Riqwan Thamir
2023-03-07 15:54:49 +01:00
committed by GitHub
parent cf51ad0d46
commit 1d09a266be
5 changed files with 105 additions and 19 deletions
@@ -1,9 +1,10 @@
import { IsOptional, IsString } from "class-validator"
import { IsOptional, IsString, IsBoolean } from "class-validator"
import { Request, Response } from "express"
import { Transform } from "class-transformer"
import { ProductCategoryService } from "../../../../services"
import { extendedFindParamsMixin } from "../../../../types/common"
import { optionalBooleanMapper } from "../../../../utils/validators/is-boolean"
import { defaultStoreScope } from "."
/**
@@ -15,6 +16,7 @@ import { defaultStoreScope } from "."
* parameters:
* - (query) q {string} Query used for searching product category names or handles.
* - (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.
* - (query) limit=100 {integer} Limit the number of product categories returned.
* x-codegen:
@@ -100,4 +102,9 @@ export class StoreGetProductCategoriesParams extends extendedFindParamsMixin({
return value === "null" ? null : value
})
parent_category_id?: string | null
@IsBoolean()
@IsOptional()
@Transform(({ value }) => optionalBooleanMapper.get(value))
include_descendants_tree?: boolean
}