feat: Allow customer metadata update (#9780)

* Allow customer metadata update 

See issue 9779
https://github.com/medusajs/medusa/issues/9779

* add integration tests for customer metadata

- Implemented integration tests to verify customer creation with metadata.
This commit is contained in:
docloulou authored and GitHub committed 2024-10-25 11:28:34 +02:00
1 parent f295596df2
commit bb6d7c6641
2 files changed
+14

No files matched your search

@@ -53,6 +53,12 @@ medusaIntegrationTestRunner({
email: "newcustomer@medusa.js", email: "newcustomer@medusa.js",
first_name: "John", first_name: "John",
last_name: "Doe", last_name: "Doe",
metadata: {
loyalty_level: "gold",
preferences: {
newsletter: true,
},
},
}, },
{ {
headers: { headers: {
@@ -69,6 +75,12 @@ medusaIntegrationTestRunner({
first_name: "John", first_name: "John",
last_name: "Doe", last_name: "Doe",
has_account: true, has_account: true,
metadata: {
loyalty_level: "gold",
preferences: {
newsletter: true,
},
},
}), }),
}) })
}) })
@@ -10,6 +10,7 @@ export const StoreCreateCustomer = z.object({
first_name: z.string().nullish(), first_name: z.string().nullish(),
last_name: z.string().nullish(), last_name: z.string().nullish(),
phone: z.string().nullish(), phone: z.string().nullish(),
metadata: z.record(z.unknown()).nullish(),
}) })
export const StoreUpdateCustomer = z.object({ export const StoreUpdateCustomer = z.object({
@@ -17,6 +18,7 @@ export const StoreUpdateCustomer = z.object({
first_name: z.string().nullish(), first_name: z.string().nullish(),
last_name: z.string().nullish(), last_name: z.string().nullish(),
phone: z.string().nullish(), phone: z.string().nullish(),
metadata: z.record(z.unknown()).nullish(),
}) })
export const StoreGetCustomerAddressParams = createSelectParams() export const StoreGetCustomerAddressParams = createSelectParams()