feat(medusa): Continue create product workflow changes (#4473)
This commit is contained in:
committed by
GitHub
parent
edf93d972d
commit
d2a8cf0378
@@ -91,8 +91,11 @@ export const simpleProductFactory = async (
|
||||
discountable: !data.is_giftcard,
|
||||
tags: [] as ProductTag[],
|
||||
profile_id: data.is_giftcard ? gcProfile?.id : defaultProfile?.id,
|
||||
profiles: [
|
||||
{ id: data.is_giftcard ? gcProfile?.id : defaultProfile?.id },
|
||||
] as ShippingProfile[],
|
||||
metadata: data.metadata || null,
|
||||
} as Product
|
||||
} as unknown as Product
|
||||
|
||||
if (typeof data.tags !== "undefined") {
|
||||
for (let i = 0; i < data.tags.length; i++) {
|
||||
|
||||
@@ -52,7 +52,7 @@ export const simpleProductVariantFactory = async (
|
||||
const options = data.options || [{ option_id: "test-option", value: "Large" }]
|
||||
for (const o of options) {
|
||||
await manager.insert(ProductOptionValue, {
|
||||
id: `${o.value}-${o.option_id ?? Math.random()}`,
|
||||
id: `${variant.id}-${o.option_id ?? Math.random()}`,
|
||||
value: o.value,
|
||||
variant_id: id,
|
||||
option_id: o.option_id,
|
||||
|
||||
@@ -40,13 +40,13 @@ export const simpleShippingOptionFactory = async (
|
||||
const defaultProfile = await manager.findOne(ShippingProfile, {
|
||||
where: {
|
||||
type: ShippingProfileType.DEFAULT,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
const gcProfile = await manager.findOne(ShippingProfile, {
|
||||
where: {
|
||||
type: ShippingProfileType.GIFT_CARD,
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
let region_id = data.region_id
|
||||
@@ -62,7 +62,7 @@ export const simpleShippingOptionFactory = async (
|
||||
is_return: data.is_return ?? false,
|
||||
region_id: region_id,
|
||||
provider_id: "test-ful",
|
||||
profile_id: data.is_giftcard ? gcProfile.id : defaultProfile.id,
|
||||
profile_id: data.is_giftcard ? gcProfile?.id : defaultProfile?.id,
|
||||
price_type: data.price_type ?? ShippingOptionPriceType.FLAT_RATE,
|
||||
data: data.data ?? {},
|
||||
requirements: (data.requirements || []) as ShippingOptionRequirement[],
|
||||
|
||||
Reference in New Issue
Block a user