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: add hooks to product module's workflows #8389

Merged
merged 9 commits into from
Aug 1, 2024

Conversation

thetutlage
Copy link
Contributor

@thetutlage thetutlage commented Aug 1, 2024

Fixes: FRMW-2641

In this PR we have introduce hooks within the product module's workflows. Following is the collection of workflows and hooks they expose.

Create action workflows

createCollectionsWorkflow
  • Hook: collectionsCreated
  • Input: { collections: ProductCollectionDTO[], additional_data?: AdditionalData }
createProductOptionsWorkflow
  • Hook: productOptionsCreated
  • Input: { product_options: ProductOptionDTO[], additional_data?: AdditionalData }
createProductTagsWorkflow
  • Hook: productTagsCreated
  • Input: { product_tags: ProductTagDTO[], additional_data?: AdditionalData }
createProductTypesWorkflow
  • Hook: productTypesCreated
  • Input: { product_types: ProductTypeDTO[], additional_data?: AdditionalData }
createProductVariantsWorkflow
  • Hook: productVariantsCreated
  • Input: { product_variants: ProductVariantDTO[], additional_data?: AdditionalData }
createProductsWorkflow
  • Hook: productsCreated
  • Input: { products: ProductDTO[], additional_data?: AdditionalData }

Update action workflows

updateCollectionsWorkflow
  • Hook: collectionsUpdated
  • Input: { collections: ProductCollectionDTO[], additional_data?: AdditionalData }
updateProductOptionsWorkflow
  • Hook: productOptionsUpdated
  • Input: { product_options: ProductOptionDTO[], additional_data?: AdditionalData }
updateProductTagsWorkflow
  • Hook: productTagsUpdated
  • Input: { product_tags: ProductTagDTO[], additional_data?: AdditionalData }
updateProductTypesWorkflow
  • Hook: productTypesUpdated
  • Input: { product_types: ProductTypeDTO[], additional_data?: AdditionalData }
updateProductVariantsWorkflow
  • Hook: productVariantsUpdated
  • Input: { product_variants: ProductVariantDTO[], additional_data?: AdditionalData }
updateProductsWorkflow
  • Hook: productsUpdated
  • Input: { products: ProductDTO[], additional_data?: AdditionalData }

Delete action workflows

deleteCollectionsWorkflow
  • Hook: collectionsDeleted
  • Input: { ids: string[] }
deleteProductOptionsWorkflow
  • Hook: productOptionsDeleted
  • Input: { ids: string[] }
deleteProductTagsWorkflow
  • Hook: productTagsDeleted
  • Input: { ids: string[] }
deleteProductTypesWorkflow
  • Hook: productTypesDeleted
  • Input: { ids: string[] }
deleteProductVariantsWorkflow
  • Hook: productVariantsDeleted
  • Input: { ids: string[] }
deleteProductsWorkflow
  • Hook: productsDeleted
  • Input: { ids: string[] }

Copy link

vercel bot commented Aug 1, 2024

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

Name Status Preview Comments Updated (UTC)
medusa-dashboard ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 1, 2024 4:20pm
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Aug 1, 2024 4:20pm
api-reference-v2 ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 4:20pm
docs-ui ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 4:20pm
docs-v2 ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 4:20pm
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 4:20pm
resources-docs ⬜️ Ignored (Inspect) Visit Preview Aug 1, 2024 4:20pm

Copy link

changeset-bot bot commented Aug 1, 2024

⚠️ No Changeset found

Latest commit: 58c0859

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

@thetutlage
Copy link
Contributor Author

Heads up @olivermrbl @adrien2p. This is approach I am planning to take.

@olivermrbl
Copy link
Contributor

olivermrbl commented Aug 1, 2024

LGTM, however, I would argue we should start with Products specifically. Collections, types, tags, categories are less important compared to the two former.

But perhaps, this was more for demonstration purposes?

@thetutlage
Copy link
Contributor Author

LGTM, however, I would argue we should start with Products specifically. Collections, types, tags, categories are less important compared to the two former.

I thought by product we mean, every workflow related to products inside the core-flows/src/products/workflows directory. But anyways, I have added hooks to all these workflows.

But perhaps, this was more for demonstration purposes?
Yes, it was

Copy link
Member

@sradevski sradevski left a comment

Choose a reason for hiding this comment

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

Really cool to support this, I think this should solve 80% of people's customization needs 👍

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.

Nice, excited about this! 🔥

@thetutlage
Copy link
Contributor Author

There is real excitement for this 🔥

@thetutlage thetutlage marked this pull request as ready for review August 1, 2024 12:13
@thetutlage thetutlage requested a review from a team as a code owner August 1, 2024 12:13
@olivermrbl
Copy link
Contributor

@thetutlage, should we merge this? 🙏

@thetutlage
Copy link
Contributor Author

Yeah. Have to update the PR description to list all hooks. I can do that post merging too

@thetutlage thetutlage merged commit 6efdba1 into develop Aug 1, 2024
23 checks passed
@thetutlage thetutlage deleted the feat/product-workflows-hooks branch August 1, 2024 16:32
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.

6 participants