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(orchestration,core-flows,medusa,product,types,utils): product import/export uses workflows #5811

Merged
merged 16 commits into from
Dec 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: fix missing test
  • Loading branch information
riqwan committed Dec 7, 2023

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 6c61b8414f62532145d5f4f4c7d1574ae1419c4a
Original file line number Diff line number Diff line change
@@ -315,19 +315,18 @@ describe("Product import batch job", () => {
profile_id: expect.any(String),
variants: expect.arrayContaining([
// UPDATED VARIANT
// TODO: figure out why this isn't being returned
// expect.objectContaining({
// id: "existing-variant-id",
// title: "Test variant changed",
// sku: "test-sku-4",
// barcode: "test-barcode-4",
// options: [
// expect.objectContaining({
// value: "Large",
// option_id: "opt-1-id",
// }),
// ],
// }),
expect.objectContaining({
id: "existing-variant-id",
title: "Test variant changed",
sku: "test-sku-4",
barcode: "test-barcode-4",
options: [
expect.objectContaining({
value: "Large",
option_id: "opt-1-id",
}),
],
}),
// CREATED VARIANT
expect.objectContaining({
title: "Test variant",
12 changes: 8 additions & 4 deletions packages/product/src/services/product-module-service.ts
Original file line number Diff line number Diff line change
@@ -67,15 +67,15 @@ import {
MedusaError,
promiseAll,
} from "@medusajs/utils"
import {
CreateProductOptionValueDTO,
UpdateProductOptionValueDTO,
} from "../types/services/product-option-value"
import {
entityNameToLinkableKeysMap,
joinerConfig,
LinkableKeys,
} from "./../joiner-config"
import {
CreateProductOptionValueDTO,
UpdateProductOptionValueDTO,
} from "../types/services/product-option-value"

type InjectedDependencies = {
baseRepository: DAL.RepositoryService
@@ -1063,6 +1063,10 @@ export default class ProductModuleService<

const existingProductVariantsMap = new Map<string, ProductVariant[]>(
data.map((productData) => {
if (productData.variants === undefined) {
return [productData.id, []]
}

const productVariantsForProduct = existingProductVariants.filter(
(variant) => variant.product_id === productData.id
)