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(medusa): added admin create endpoint for nested categories #2985

Merged
merged 9 commits into from
Jan 11, 2023

Conversation

riqwan
Copy link
Contributor

@riqwan riqwan commented Jan 11, 2023

What:

Introduces an admin endpoint that allows a user to create a product category

Why:

This is part of a greater goal of allowing products to be added to multiple categories.

How:

  • Creates a route on the admin scope to create category
  • Creates a method in product category services to create a category

RESOLVES CORE-958

@changeset-bot
Copy link

changeset-bot bot commented Jan 11, 2023

🦋 Changeset detected

Latest commit: bbc0b3e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@medusajs/medusa Patch

Not sure what this means? Click here to learn what changesets are.

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

@riqwan riqwan marked this pull request as ready for review January 11, 2023 05:19
@riqwan riqwan requested a review from a team as a code owner January 11, 2023 05:19
@riqwan riqwan force-pushed the feat/nested-category-create-endpoint branch from b0dd13e to 0357518 Compare January 11, 2023 05:53
@riqwan riqwan force-pushed the feat/nested-category-create-endpoint branch from 0357518 to d8d59f6 Compare January 11, 2023 06:13
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! 🎆

packages/medusa/src/types/product-category.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@pKorsholm pKorsholm left a comment

Choose a reason for hiding this comment

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

LGTM! (not duplicating comments)

one question: should we add events for creation/updates(updation?)/deletion as well?

this could easily be a future pr, so definitely non-blocking as of now 😄

@riqwan riqwan force-pushed the feat/nested-category-create-endpoint branch from 7311999 to 98d2f93 Compare January 11, 2023 12:33
@olivermrbl
Copy link
Contributor

@adrien2p Will you revisit your review, so we can merge? :)

@@ -41,14 +42,18 @@ export class ProductCategory extends SoftDeletableEntity {

// Typeorm also keeps track of the category's parent at all times.
@Column()
parent_category_id: ProductCategory
parent_category_id: string | null
Copy link
Member

Choose a reason for hiding this comment

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

nice catch 🙏


const api = useApi()

const response = await api.post(
Copy link
Member

Choose a reason for hiding this comment

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

non blocking: should we add a tests without passing the handle to also assert that this behaviour do not broke at some point?

Copy link
Member

@adrien2p adrien2p left a comment

Choose a reason for hiding this comment

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

LGTM, nonblocking suggestion

@kodiakhq kodiakhq bot merged commit 8ed4eab into develop Jan 11, 2023
@riqwan riqwan deleted the feat/nested-category-create-endpoint branch January 11, 2023 14:51
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.

4 participants