Skip to content

Commit

Permalink
feat: Allow customer metadata update (#9780)
Browse files Browse the repository at this point in the history
* Allow customer metadata update 

See issue 9779
#9779

* add integration tests for customer metadata

- Implemented integration tests to verify customer creation with metadata.
  • Loading branch information
docloulou authored Oct 25, 2024
1 parent f295596 commit bb6d7c6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions integration-tests/http/__tests__/customer/store/customer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ medusaIntegrationTestRunner({
email: "[email protected]",
first_name: "John",
last_name: "Doe",
metadata: {
loyalty_level: "gold",
preferences: {
newsletter: true,
},
},
},
{
headers: {
Expand All @@ -69,6 +75,12 @@ medusaIntegrationTestRunner({
first_name: "John",
last_name: "Doe",
has_account: true,
metadata: {
loyalty_level: "gold",
preferences: {
newsletter: true,
},
},
}),
})
})
Expand Down
2 changes: 2 additions & 0 deletions packages/medusa/src/api/store/customers/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ export const StoreCreateCustomer = z.object({
first_name: z.string().nullish(),
last_name: z.string().nullish(),
phone: z.string().nullish(),
metadata: z.record(z.unknown()).nullish(),
})

export const StoreUpdateCustomer = z.object({
company_name: z.string().nullish(),
first_name: z.string().nullish(),
last_name: z.string().nullish(),
phone: z.string().nullish(),
metadata: z.record(z.unknown()).nullish(),
})

export const StoreGetCustomerAddressParams = createSelectParams()
Expand Down

0 comments on commit bb6d7c6

Please sign in to comment.