fix: Tax region + rates clean up (#9279)
What - Require `code` on Tax Rates - Update dashboard to account for non-nullable code on Tax Rates - Include `automatic_taxes` in API Route response Closes CC-524 CC-525
This commit is contained in:
@@ -5,6 +5,7 @@ export const defaultAdminRegionFields = [
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"deleted_at",
|
||||
"automatic_taxes",
|
||||
"metadata",
|
||||
"*countries",
|
||||
]
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
import { createRegionsWorkflow } from "@medusajs/core-flows"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
import {
|
||||
ContainerRegistrationKeys,
|
||||
remoteQueryObjectFromString,
|
||||
} from "@medusajs/framework/utils"
|
||||
import {
|
||||
AuthenticatedMedusaRequest,
|
||||
MedusaResponse,
|
||||
} from "../../../types/routing"
|
||||
import { refetchRegion } from "./helpers"
|
||||
import { HttpTypes } from "@medusajs/framework/types"
|
||||
|
||||
export const GET = async (
|
||||
req: AuthenticatedMedusaRequest<HttpTypes.AdminRegionFilters>,
|
||||
|
||||
@@ -36,7 +36,7 @@ export const AdminCreateTaxRateRule = z.object({
|
||||
export type AdminCreateTaxRateType = z.infer<typeof AdminCreateTaxRate>
|
||||
export const AdminCreateTaxRate = z.object({
|
||||
rate: z.number().optional(),
|
||||
code: z.string().optional(),
|
||||
code: z.string(),
|
||||
rules: z.array(AdminCreateTaxRateRule).optional(),
|
||||
name: z.string(),
|
||||
is_default: z.boolean().optional(),
|
||||
@@ -48,7 +48,7 @@ export const AdminCreateTaxRate = z.object({
|
||||
export type AdminUpdateTaxRateType = z.infer<typeof AdminUpdateTaxRate>
|
||||
export const AdminUpdateTaxRate = z.object({
|
||||
rate: z.number().optional(),
|
||||
code: z.string().nullish(),
|
||||
code: z.string().optional(),
|
||||
rules: z.array(AdminCreateTaxRateRule).optional(),
|
||||
name: z.string().optional(),
|
||||
is_default: z.boolean().optional(),
|
||||
|
||||
@@ -46,7 +46,7 @@ export const AdminCreateTaxRegion = z.object({
|
||||
default_tax_rate: z
|
||||
.object({
|
||||
rate: z.number().optional(),
|
||||
code: z.string().optional(),
|
||||
code: z.string(),
|
||||
name: z.string(),
|
||||
is_combinable: z.boolean().optional(),
|
||||
metadata: z.record(z.unknown()).nullish(),
|
||||
|
||||
Reference in New Issue
Block a user