-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
fix: Fixes to product module and improving tests #6898
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
@@ -2585,102 +2546,6 @@ medusaIntegrationTestRunner({ | |||
expect(variantPost).not.toBeTruthy() | |||
}) | |||
|
|||
// TODO: This one is a bit more complex, leaving for later | |||
it.skip("successfully deletes a product variant and its associated option values", async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is testing implementation detail of the module, and as such I moved the tests to the module (there already was a test for the product, I just added one for the variant)
@@ -2008,7 +2006,8 @@ medusaIntegrationTestRunner({ | |||
}) | |||
}) | |||
|
|||
it("successfully updates a variant's price by changing an existing price (given a region_id)", async () => { | |||
// TODO: Do we want to add support for region prices through the product APIs? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think we should keep this. On the product details page, we allow you to update region and currency prices for variants in the bulk editor.
That said, I would be fine starting with the currency prices, so this doesn't block the end-to-end flows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I'll tackle it once we have a full end-to-end setup in place 👍
@@ -15,6 +15,7 @@ export const updateProductsWorkflow = createWorkflow( | |||
( | |||
input: WorkflowData<WorkflowInput> | |||
): WorkflowData<ProductTypes.ProductDTO[]> => { | |||
// TODO: Delete price sets for removed variants |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Wouldn't the cascade on the link definition take care of this? At least I would expect it to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theoretically, when calling remoteLink.delete, it will call the module service softDelete method, to cascade the deletion, the soft delete will return the deleted entries deeply mapped with the linkable keys and allow to perform the cascade soft delete to all the module services.
The same should apply for restoring.
That way, if soft deleting a variant is cascading to other entities that have a linkable key, we can also perform the cascade for those entities that was link to something else.
To see more, you can look at the executeCascade on the remote link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the only issue is that we currently don't do a soft-delete in the upsertWithReplace, and at this point we don't handle the deleted variants in any way. In the deleteVariants
workflow this is already handled. Since this doesn't block end-to-end flow for now I decided not to do it for now.
19e3690
to
a148ad8
Compare
/** | ||
* When the product variant option was deleted. | ||
*/ | ||
deleted_at?: string | Date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted_at?: string | Date | |
deleted_at: string | Date | null |
No description provided.