feat(dashboard): metadata component (#7117)
**What** - add new metadata component **Note** - _example of usage on customer edit form_ - we are not handling update metadata case in the internal module service so for now delete case doesn't work properly --- https://github.com/medusajs/medusa/assets/16856471/b588752d-9cf5-4d96-9cf8-760a764ab03e
This commit is contained in:
1 parent
ea1d926dfa
commit
155e276b90
11 files changed
+278
-5
No files matched your search
@@ -3,7 +3,7 @@ import * as QueryConfig from "./query-config"
|
||||
import {
|
||||
AdminCreateCustomer,
|
||||
AdminCreateCustomerAddress,
|
||||
AdminCustomerAdressesParams,
|
||||
AdminCustomerAddressesParams,
|
||||
AdminCustomerParams,
|
||||
AdminCustomersParams,
|
||||
AdminUpdateCustomer,
|
||||
@@ -100,7 +100,7 @@ export const adminCustomerRoutesMiddlewares: MiddlewareRoute[] = [
|
||||
matcher: "/admin/customers/:id/addresses",
|
||||
middlewares: [
|
||||
validateAndTransformQuery(
|
||||
AdminCustomerAdressesParams,
|
||||
AdminCustomerAddressesParams,
|
||||
QueryConfig.listAddressesTransformQueryConfig
|
||||
),
|
||||
],
|
||||
|
||||
@@ -5,6 +5,7 @@ export const defaultAdminCustomerFields = [
|
||||
"last_name",
|
||||
"email",
|
||||
"phone",
|
||||
"metadata",
|
||||
"has_account",
|
||||
"created_by",
|
||||
"created_at",
|
||||
|
||||
@@ -48,6 +48,7 @@ export const AdminCreateCustomer = z.object({
|
||||
first_name: z.string().optional(),
|
||||
last_name: z.string().optional(),
|
||||
phone: z.string().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
})
|
||||
|
||||
export const AdminUpdateCustomer = z.object({
|
||||
@@ -56,6 +57,7 @@ export const AdminUpdateCustomer = z.object({
|
||||
first_name: z.string().nullable().optional(),
|
||||
last_name: z.string().nullable().optional(),
|
||||
phone: z.string().nullable().optional(),
|
||||
metadata: z.record(z.unknown()).optional(),
|
||||
})
|
||||
|
||||
export const AdminCreateCustomerAddress = z.object({
|
||||
@@ -77,7 +79,7 @@ export const AdminCreateCustomerAddress = z.object({
|
||||
|
||||
export const AdminUpdateCustomerAddress = AdminCreateCustomerAddress
|
||||
|
||||
export const AdminCustomerAdressesParams = createFindParams({
|
||||
export const AdminCustomerAddressesParams = createFindParams({
|
||||
offset: 0,
|
||||
limit: 50,
|
||||
}).merge(
|
||||
|
||||
Reference in new issue
Block a user