fix(medusa): Apply middleware to GET customers/:id/addresses/:address_id (#11788)
This commit is contained in:
committed by
GitHub
parent
4c28efaadc
commit
90964a404e
5
.changeset/gorgeous-rats-watch.md
Normal file
5
.changeset/gorgeous-rats-watch.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/medusa": patch
|
||||
---
|
||||
|
||||
fix(medusa): Apply middleware to GET customers/:id/addresses/:address_id
|
||||
@@ -4,17 +4,18 @@ import {
|
||||
AdminCreateCustomer,
|
||||
AdminCreateCustomerAddress,
|
||||
AdminCustomerAddressesParams,
|
||||
AdminCustomerAddressParams,
|
||||
AdminCustomerParams,
|
||||
AdminCustomersParams,
|
||||
AdminUpdateCustomer,
|
||||
AdminUpdateCustomerAddress,
|
||||
} from "./validators"
|
||||
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import {
|
||||
validateAndTransformBody,
|
||||
validateAndTransformQuery,
|
||||
} from "@medusajs/framework"
|
||||
import { MiddlewareRoute } from "@medusajs/framework/http"
|
||||
import { createLinkBody } from "../../utils/validators"
|
||||
|
||||
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"],
|
||||
matcher: "/admin/customers/:id/addresses/:address_id",
|
||||
|
||||
@@ -90,6 +90,8 @@ export const AdminCreateCustomerAddress = WithAdditionalData(
|
||||
|
||||
export const AdminUpdateCustomerAddress = AdminCreateCustomerAddress
|
||||
|
||||
export const AdminCustomerAddressParams = createSelectParams()
|
||||
|
||||
export const AdminCustomerAddressesParams = createFindParams({
|
||||
offset: 0,
|
||||
limit: 50,
|
||||
@@ -108,6 +110,9 @@ export type AdminCustomerParamsType = z.infer<typeof AdminCustomerParams>
|
||||
export type AdminCustomersParamsType = z.infer<typeof AdminCustomersParams>
|
||||
export type AdminCreateCustomerType = z.infer<typeof CreateCustomer>
|
||||
export type AdminUpdateCustomerType = z.infer<typeof UpdateCustomer>
|
||||
export type AdminCustomerAddressParamsType = z.infer<
|
||||
typeof AdminCustomerAddressParams
|
||||
>
|
||||
export type AdminCreateCustomerAddressType = z.infer<
|
||||
typeof CreateCustomerAddress
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user