fix(medusa): Apply middleware to GET customers/:id/addresses/:address_id (#11788)
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/medusa": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(medusa): Apply middleware to GET customers/:id/addresses/:address_id
|
||||||
@@ -4,17 +4,18 @@ import {
|
|||||||
AdminCreateCustomer,
|
AdminCreateCustomer,
|
||||||
AdminCreateCustomerAddress,
|
AdminCreateCustomerAddress,
|
||||||
AdminCustomerAddressesParams,
|
AdminCustomerAddressesParams,
|
||||||
|
AdminCustomerAddressParams,
|
||||||
AdminCustomerParams,
|
AdminCustomerParams,
|
||||||
AdminCustomersParams,
|
AdminCustomersParams,
|
||||||
AdminUpdateCustomer,
|
AdminUpdateCustomer,
|
||||||
AdminUpdateCustomerAddress,
|
AdminUpdateCustomerAddress,
|
||||||
} from "./validators"
|
} from "./validators"
|
||||||
|
|
||||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
|
||||||
import {
|
import {
|
||||||
validateAndTransformBody,
|
validateAndTransformBody,
|
||||||
validateAndTransformQuery,
|
validateAndTransformQuery,
|
||||||
} from "@medusajs/framework"
|
} from "@medusajs/framework"
|
||||||
|
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||||
import { createLinkBody } from "../../utils/validators"
|
import { createLinkBody } from "../../utils/validators"
|
||||||
|
|
||||||
export const adminCustomerRoutesMiddlewares: MiddlewareRoute[] = [
|
export const adminCustomerRoutesMiddlewares: MiddlewareRoute[] = [
|
||||||
@@ -71,6 +72,16 @@ export const adminCustomerRoutesMiddlewares: MiddlewareRoute[] = [
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
method: ["GET"],
|
||||||
|
matcher: "/admin/customers/:id/addresses/:address_id",
|
||||||
|
middlewares: [
|
||||||
|
validateAndTransformQuery(
|
||||||
|
AdminCustomerAddressParams,
|
||||||
|
QueryConfig.retrieveTransformQueryConfig
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
method: ["POST"],
|
method: ["POST"],
|
||||||
matcher: "/admin/customers/:id/addresses/:address_id",
|
matcher: "/admin/customers/:id/addresses/:address_id",
|
||||||
|
|||||||
@@ -90,6 +90,8 @@ export const AdminCreateCustomerAddress = WithAdditionalData(
|
|||||||
|
|
||||||
export const AdminUpdateCustomerAddress = AdminCreateCustomerAddress
|
export const AdminUpdateCustomerAddress = AdminCreateCustomerAddress
|
||||||
|
|
||||||
|
export const AdminCustomerAddressParams = createSelectParams()
|
||||||
|
|
||||||
export const AdminCustomerAddressesParams = createFindParams({
|
export const AdminCustomerAddressesParams = createFindParams({
|
||||||
offset: 0,
|
offset: 0,
|
||||||
limit: 50,
|
limit: 50,
|
||||||
@@ -108,6 +110,9 @@ export type AdminCustomerParamsType = z.infer<typeof AdminCustomerParams>
|
|||||||
export type AdminCustomersParamsType = z.infer<typeof AdminCustomersParams>
|
export type AdminCustomersParamsType = z.infer<typeof AdminCustomersParams>
|
||||||
export type AdminCreateCustomerType = z.infer<typeof CreateCustomer>
|
export type AdminCreateCustomerType = z.infer<typeof CreateCustomer>
|
||||||
export type AdminUpdateCustomerType = z.infer<typeof UpdateCustomer>
|
export type AdminUpdateCustomerType = z.infer<typeof UpdateCustomer>
|
||||||
|
export type AdminCustomerAddressParamsType = z.infer<
|
||||||
|
typeof AdminCustomerAddressParams
|
||||||
|
>
|
||||||
export type AdminCreateCustomerAddressType = z.infer<
|
export type AdminCreateCustomerAddressType = z.infer<
|
||||||
typeof CreateCustomerAddress
|
typeof CreateCustomerAddress
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user