feat: Use tag ids instead of values wherever possible (#8394)
This commit is contained in:
@@ -2,6 +2,7 @@ import { z } from "zod"
|
||||
import {
|
||||
GetProductsParams,
|
||||
ProductStatusEnum,
|
||||
transformProductParams,
|
||||
} from "../../utils/common-validators"
|
||||
import {
|
||||
createFindParams,
|
||||
@@ -45,28 +46,30 @@ export type StoreGetProductsParamsType = z.infer<typeof StoreGetProductsParams>
|
||||
export const StoreGetProductsParams = createFindParams({
|
||||
offset: 0,
|
||||
limit: 50,
|
||||
}).merge(
|
||||
z
|
||||
.object({
|
||||
// These are used to populate the tax and pricing context
|
||||
region_id: z.string().optional(),
|
||||
country_code: z.string().optional(),
|
||||
province: z.string().optional(),
|
||||
cart_id: z.string().optional(),
|
||||
})
|
||||
.merge(
|
||||
z
|
||||
.object({
|
||||
// These are used to populate the tax and pricing context
|
||||
region_id: z.string().optional(),
|
||||
country_code: z.string().optional(),
|
||||
province: z.string().optional(),
|
||||
cart_id: z.string().optional(),
|
||||
|
||||
variants: z
|
||||
.object({
|
||||
status: ProductStatusEnum.array().optional(),
|
||||
options: z
|
||||
.object({ value: z.string(), option_id: z.string() })
|
||||
.optional(),
|
||||
$and: z.lazy(() => StoreGetProductsParams.array()).optional(),
|
||||
$or: z.lazy(() => StoreGetProductsParams.array()).optional(),
|
||||
})
|
||||
.optional(),
|
||||
$and: z.lazy(() => StoreGetProductsParams.array()).optional(),
|
||||
$or: z.lazy(() => StoreGetProductsParams.array()).optional(),
|
||||
})
|
||||
.merge(GetProductsParams)
|
||||
.strict()
|
||||
)
|
||||
variants: z
|
||||
.object({
|
||||
status: ProductStatusEnum.array().optional(),
|
||||
options: z
|
||||
.object({ value: z.string(), option_id: z.string() })
|
||||
.optional(),
|
||||
$and: z.lazy(() => StoreGetProductsParams.array()).optional(),
|
||||
$or: z.lazy(() => StoreGetProductsParams.array()).optional(),
|
||||
})
|
||||
.optional(),
|
||||
$and: z.lazy(() => StoreGetProductsParams.array()).optional(),
|
||||
$or: z.lazy(() => StoreGetProductsParams.array()).optional(),
|
||||
})
|
||||
.merge(GetProductsParams)
|
||||
.strict()
|
||||
)
|
||||
.transform(transformProductParams)
|
||||
|
||||
Reference in New Issue
Block a user