feat(region): Region create, delete, update admin endpoints (#6332)
**What** Add `POST /admin/regions` Add `POST /admin/regions/:id` Add `DELETE /admin/regions/:id` All are added for v2 using API Routes and workflows. In follow-up PRs, I will add support for passing countries in update and create. Update: First follow-up PR is #6372
This commit is contained in:
1 parent
1d91b7429b
commit
691f68c3b8
22 files changed
+586
-169
No files matched your search
@@ -1,24 +1,22 @@
|
||||
import { RegionCurrencyDTO } from "./common"
|
||||
|
||||
export interface CreateRegionDTO {
|
||||
name: string
|
||||
currency_code: string
|
||||
currency?: RegionCurrencyDTO
|
||||
countries?: string[]
|
||||
tax_code?: string
|
||||
tax_rate?: number
|
||||
tax_provider_id?: string
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface UpdateRegionDTO {
|
||||
id: string
|
||||
currency_code?: string
|
||||
currency?: RegionCurrencyDTO
|
||||
countries: string[]
|
||||
countries?: string[]
|
||||
name?: string
|
||||
tax_code?: string
|
||||
tax_rate?: number
|
||||
tax_provider_id?: string
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface UpdatableRegionFields {
|
||||
currency_code?: string
|
||||
name?: string
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export interface AddCountryToRegionDTO {
|
||||
|
||||
@@ -10,14 +10,27 @@ import {
|
||||
RegionCurrencyDTO,
|
||||
RegionDTO,
|
||||
} from "./common"
|
||||
import { CreateRegionDTO, UpdateRegionDTO } from "./mutations"
|
||||
import {
|
||||
CreateRegionDTO,
|
||||
UpdatableRegionFields,
|
||||
UpdateRegionDTO,
|
||||
} from "./mutations"
|
||||
|
||||
export interface IRegionModuleService extends IModuleService {
|
||||
create(data: CreateRegionDTO[], sharedContext?: Context): Promise<RegionDTO[]>
|
||||
create(data: CreateRegionDTO, sharedContext?: Context): Promise<RegionDTO>
|
||||
|
||||
update(data: UpdateRegionDTO[], sharedContext?: Context): Promise<RegionDTO[]>
|
||||
update(data: UpdateRegionDTO, sharedContext?: Context): Promise<RegionDTO>
|
||||
update(data: UpdateRegionDTO[]): Promise<RegionDTO[]>
|
||||
update(
|
||||
selector: FilterableRegionProps,
|
||||
data: UpdatableRegionFields,
|
||||
sharedContext?: Context
|
||||
): Promise<RegionDTO[]>
|
||||
update(
|
||||
regionId: string,
|
||||
data: UpdatableRegionFields,
|
||||
sharedContext?: Context
|
||||
): Promise<RegionDTO>
|
||||
|
||||
delete(ids: string[], sharedContext?: Context): Promise<void>
|
||||
delete(id: string, sharedContext?: Context): Promise<void>
|
||||
|
||||
Reference in new issue
Block a user