feat(medusa): Filter products by category params in store/admin (#3155)
What: Products can be filtered through the API by category parameters Why: To filter products by category How: - adds 2 params in admin/store route - updates repository to accept 2 new parameters RESOLVES CORE-1032 RESOLVES CORE-1033
This commit is contained in:
@@ -83,6 +83,16 @@ import { FilterableProductProps } from "../../../../types/product"
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* - in: query
|
||||
* name: category_id
|
||||
* style: form
|
||||
* explode: false
|
||||
* description: Category IDs to filter products by
|
||||
* schema:
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* - (query) include_category_children {boolean} Include category children when filtering by category_id
|
||||
* - (query) title {string} title to search for.
|
||||
* - (query) description {string} description to search for.
|
||||
* - (query) handle {string} handle to search for.
|
||||
|
||||
@@ -125,6 +125,16 @@ import PublishableAPIKeysFeatureFlag from "../../../../loaders/feature-flags/pub
|
||||
* type: string
|
||||
* description: filter by dates greater than or equal to this date
|
||||
* format: date
|
||||
* - in: query
|
||||
* name: category_id
|
||||
* style: form
|
||||
* explode: false
|
||||
* description: Category ids to filter by.
|
||||
* schema:
|
||||
* type: array
|
||||
* items:
|
||||
* type: string
|
||||
* - (query) include_category_children {boolean} Include category children when filtering by category_id.
|
||||
* - (query) offset=0 {integer} How many products to skip in the result.
|
||||
* - (query) limit=100 {integer} Limit the number of products returned.
|
||||
* - (query) expand {string} (Comma separated) Which fields should be expanded in each order of the result.
|
||||
@@ -303,6 +313,15 @@ export class StoreGetProductsParams extends StoreGetProductsPaginationParams {
|
||||
@FeatureFlagDecorators(SalesChannelFeatureFlag.key, [IsOptional(), IsArray()])
|
||||
sales_channel_id?: string[]
|
||||
|
||||
@IsArray()
|
||||
@IsOptional()
|
||||
category_id?: string[]
|
||||
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
@Transform(({ value }) => optionalBooleanMapper.get(value.toLowerCase()))
|
||||
include_category_children?: boolean
|
||||
|
||||
@IsOptional()
|
||||
@ValidateNested()
|
||||
@Type(() => DateComparisonOperator)
|
||||
|
||||
Reference in New Issue
Block a user