feat: Convert several batch methods to the standardized format (#7116)

This commit is contained in:
Stevche Radevski
2024-04-22 16:35:10 +02:00
committed by GitHub
parent 0eb68541b8
commit 0df523594f
63 changed files with 614 additions and 919 deletions
+15 -2
View File
@@ -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 }[]
}