feat: Update service zone (#6990)

This commit is contained in:
Oli Juhl
2024-04-07 17:30:55 +02:00
committed by GitHub
parent b6879f017a
commit a24d6e6c97
16 changed files with 576 additions and 194 deletions
@@ -17,7 +17,7 @@ export interface CreateServiceZoneDTO {
}
export interface UpdateServiceZoneDTO {
id: string
id?: string
name?: string
geo_zones?: (
| Omit<CreateCountryGeoZoneDTO, "service_zone_id">
@@ -27,3 +27,5 @@ export interface UpdateServiceZoneDTO {
| { id: string }
)[]
}
export interface UpsertServiceZoneDTO extends UpdateServiceZoneDTO {}
+23 -10
View File
@@ -1,4 +1,7 @@
import { FindConfig } from "../common"
import { RestoreReturn, SoftDeleteReturn } from "../dal"
import { IModuleService } from "../modules-sdk"
import { Context } from "../shared-context"
import {
FilterableFulfillmentProps,
FilterableFulfillmentSetProps,
@@ -18,9 +21,6 @@ import {
ShippingOptionTypeDTO,
ShippingProfileDTO,
} from "./common"
import { FindConfig } from "../common"
import { Context } from "../shared-context"
import { RestoreReturn, SoftDeleteReturn } from "../dal"
import {
CreateFulfillmentSetDTO,
CreateGeoZoneDTO,
@@ -34,9 +34,10 @@ import {
UpdateShippingOptionDTO,
UpdateShippingOptionRuleDTO,
UpdateShippingProfileDTO,
UpsertServiceZoneDTO,
} from "./mutations"
import { CreateShippingProfileDTO } from "./mutations/shipping-profile"
import { CreateFulfillmentDTO } from "./mutations/fulfillment"
import { CreateShippingProfileDTO } from "./mutations/shipping-profile"
export interface IFulfillmentModuleService extends IModuleService {
/**
@@ -176,17 +177,29 @@ export interface IFulfillmentModuleService extends IModuleService {
): Promise<ServiceZoneDTO>
/**
* Update a service zone
* @param data
* @param sharedContext
*/
updateServiceZones(
data: UpdateServiceZoneDTO[],
sharedContext?: Context
): Promise<ServiceZoneDTO[]>
updateServiceZones(
id: string,
data: UpdateServiceZoneDTO,
sharedContext?: Context
): Promise<ServiceZoneDTO>
updateServiceZones(
selector: FilterableServiceZoneProps,
data: UpdateServiceZoneDTO,
sharedContext?: Context
): Promise<ServiceZoneDTO[]>
/**
* Upsert a service zone
*/
upsertServiceZones(
data: UpsertServiceZoneDTO,
sharedContext?: Context
): Promise<ServiceZoneDTO>
upsertServiceZones(
data: UpsertServiceZoneDTO[],
sharedContext?: Context
): Promise<ServiceZoneDTO[]>
/**
* Delete a service zone
* @param ids
@@ -3,7 +3,7 @@ import { AdminServiceZoneResponse } from "./service-zone"
/**
* @experimental
*/
export interface AdminFulfillmentSetResponse {
export interface FulfillmentSetResponse {
id: string
name: string
type: string
@@ -13,3 +13,10 @@ export interface AdminFulfillmentSetResponse {
updated_at: Date
deleted_at: Date | null
}
/**
* @experimental
*/
export interface AdminFulfillmentSetResponse {
fulfillment_set: FulfillmentSetResponse
}
@@ -1,3 +1,4 @@
import { FulfillmentSetResponse } from "./fulfillment-set"
import { AdminGeoZoneResponse } from "./geo-zone"
/**
@@ -12,3 +13,13 @@ export interface AdminServiceZoneResponse {
updated_at: Date
deleted_at: Date | null
}
/**
* @experimental
*/
export interface AdminServiceZoneDeleteResponse {
id: string
object: "service-zone"
deleted: boolean
parent: FulfillmentSetResponse
}
@@ -1,2 +1,2 @@
export * from "./create-service-zones"
export * from "./create-shipping-options"
export * from "./service-zones"
@@ -3,6 +3,7 @@ import {
CreateCountryGeoZoneDTO,
CreateProvinceGeoZoneDTO,
CreateZipGeoZoneDTO,
FilterableServiceZoneProps,
} from "../../fulfillment"
interface CreateServiceZone {
@@ -19,3 +20,19 @@ interface CreateServiceZone {
export interface CreateServiceZonesWorkflowInput {
data: CreateServiceZone[]
}
interface UpdateServiceZone {
name?: string
geo_zones?: (
| Omit<CreateCountryGeoZoneDTO, "service_zone_id">
| Omit<CreateProvinceGeoZoneDTO, "service_zone_id">
| Omit<CreateCityGeoZoneDTO, "service_zone_id">
| Omit<CreateZipGeoZoneDTO, "service_zone_id">
| { id: string }
)[]
}
export interface UpdateServiceZonesWorkflowInput {
selector: FilterableServiceZoneProps
update: UpdateServiceZone
}