chore(product): revamp upsertWithReplace and Remove its usage from product creation (#11585)

**What**
- Move create product to use native create by structuring the data appropriately, it means no more `upsertWithReplace` being very poorly performant and got 20x better performances on staging
- Improvements in `upsertWithReplace` to still get performance boost for places that still relies on it. Mostly bulking the operations when possible

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
This commit is contained in:
Adrien de Peretti
2025-02-26 10:53:13 +01:00
committed by GitHub
parent a35c9ed741
commit eeebb35758
9 changed files with 277 additions and 130 deletions

View File

@@ -533,7 +533,7 @@ medusaIntegrationTestRunner({
)
})
it("should fail on non-existent product fields being present in the CSV", async () => {
it("should successfully skip non-existent product fields being present in the CSV", async () => {
const subscriberExecution = TestEventUtils.waitSubscribersExecution(
`${Modules.NOTIFICATION}.notification.${CommonEvents.CREATED}`,
eventBus
@@ -582,10 +582,21 @@ medusaIntegrationTestRunner({
expect.objectContaining({
data: expect.objectContaining({
title: "Product import",
description: `Failed to import products from file test.csv`,
description:
"Product import of file test.csv completed successfully!",
}),
})
)
const [importedProduct] = (
await api.get("/admin/products?limit=1&order=-id", adminHeaders)
).data.products
expect(importedProduct).not.toEqual(
expect.objectContaining({
field: "Test product",
})
)
})
it("supports importing the v1 template", async () => {