feat: Convert several batch methods to the standardized format (#7116)
This commit is contained in:
@@ -3,13 +3,19 @@ export type LinkMethodRequest = {
|
||||
remove?: string[]
|
||||
}
|
||||
|
||||
export type BatchMethodRequest<TCreate extends any, TUpdate extends any> = {
|
||||
export type LinkWorkflowInput = {
|
||||
id: string
|
||||
add?: string[]
|
||||
remove?: string[]
|
||||
}
|
||||
|
||||
export type BatchMethodRequest<TCreate, TUpdate> = {
|
||||
create?: TCreate[]
|
||||
update?: TUpdate[]
|
||||
delete?: string[]
|
||||
}
|
||||
|
||||
export type BatchMethodResponse<T extends any> = {
|
||||
export type BatchMethodResponse<T> = {
|
||||
created: T[]
|
||||
updated: T[]
|
||||
deleted: {
|
||||
@@ -18,3 +24,10 @@ export type BatchMethodResponse<T extends any> = {
|
||||
deleted: boolean
|
||||
}
|
||||
}
|
||||
|
||||
export type BatchWorkflowInput<TCreate, TUpdate> = BatchMethodRequest<
|
||||
TCreate,
|
||||
TUpdate
|
||||
>
|
||||
|
||||
export type BatchWorkflowOutput<T> = BatchMethodResponse<T>
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
import { LinkMethodRequest } from "../../common"
|
||||
import { PricingTypes, ProductTypes } from "../../bundles"
|
||||
|
||||
export interface BatchLinkProductsToCollectionDTO extends LinkMethodRequest {
|
||||
id: string
|
||||
export type CreateProductVariantWorkflowInputDTO =
|
||||
ProductTypes.CreateProductVariantDTO & {
|
||||
prices?: PricingTypes.CreateMoneyAmountDTO[]
|
||||
}
|
||||
|
||||
export type UpdateProductVariantWorkflowInputDTO =
|
||||
(ProductTypes.UpsertProductVariantDTO & {
|
||||
prices?: PricingTypes.CreateMoneyAmountDTO[]
|
||||
})[]
|
||||
|
||||
export type CreateProductWorkflowInputDTO = Omit<
|
||||
ProductTypes.CreateProductDTO,
|
||||
"variants"
|
||||
> & {
|
||||
sales_channels?: { id: string }[]
|
||||
variants?: CreateProductVariantWorkflowInputDTO[]
|
||||
}
|
||||
|
||||
export type UpdateProductWorkflowInputDTO = ProductTypes.UpsertProductDTO & {
|
||||
sales_channels?: { id: string }[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user