Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(customer): admin CRUD endpoints #6232

Merged
merged 13 commits into from
Jan 30, 2024
Merged

feat(customer): admin CRUD endpoints #6232

merged 13 commits into from
Jan 30, 2024

Conversation

srindom
Copy link
Collaborator

@srindom srindom commented Jan 26, 2024

What

  • GET /customers/:id
  • POST /customers/:id
  • DELETE /customers/:id
  • POST /customers

Including workflows for each.

Copy link

changeset-bot bot commented Jan 26, 2024

⚠️ No Changeset found

Latest commit: 91a8eaa

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jan 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference 🔄 Building (Inspect) Visit Preview Jan 30, 2024 11:23am
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 30, 2024 11:23am
2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
docs-ui ⬜️ Ignored (Inspect) Visit Preview Jan 30, 2024 11:23am
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Jan 30, 2024 11:23am

@srindom srindom changed the base branch from develop to feat/customer-endpoints January 26, 2024 11:09
@srindom srindom force-pushed the feat/customer-endpoints branch from baeccb9 to c37b269 Compare January 26, 2024 20:35
@srindom srindom changed the base branch from feat/customer-endpoints to develop January 29, 2024 17:01
@srindom srindom marked this pull request as ready for review January 29, 2024 17:31
@srindom srindom requested review from a team as code owners January 29, 2024 17:31
@srindom srindom changed the title Feat/customer admin feat(customer): admin CRUD endpoints Jan 30, 2024
Copy link
Contributor

@riqwan riqwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some suggestions, but lgtm!

Comment on lines 122 to 123
@IsOptional()
email?: string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@IsOptional()
email?: string
email: string

Should we change this here as well?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so since this is an optional field in the validator right?

Comment on lines +48 to +55
prevCustomers.map((c) =>
service.update(c.id, {
first_name: c.first_name,
last_name: c.last_name,
email: c.email,
phone: c.phone,
metadata: c.metadata,
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might backfire if any of these attributes are not present in the data object itself. Nothing to do here for now, just FYI I'm working on a util to sanitize the data to the needed selects and relationships when reverting an update.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Contributor

@fPolic fPolic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@olivermrbl olivermrbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment on lines +7 to +9
export const deleteCustomerStepId = "delete-customer"
export const deleteCustomerStep = createStep(
deleteCustomerStepId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Consistent with how other workflows and steps are named

Suggested change
export const deleteCustomerStepId = "delete-customer"
export const deleteCustomerStep = createStep(
deleteCustomerStepId,
export const deleteCustomersStepId = "delete-customer"
export const deleteCustomersStep = createStep(
deleteCustomerStepId,

@kodiakhq kodiakhq bot merged commit 18ff739 into develop Jan 30, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants