fix(medusa): Allow deleting metadata fields (#3055)
This commit is contained in:
@@ -5,17 +5,17 @@ import {
|
||||
ProductType,
|
||||
ShippingProfile,
|
||||
ShippingProfileType,
|
||||
Store
|
||||
Store,
|
||||
} from "@medusajs/medusa"
|
||||
import faker from "faker"
|
||||
import { Connection } from "typeorm"
|
||||
import {
|
||||
ProductVariantFactoryData,
|
||||
simpleProductVariantFactory
|
||||
simpleProductVariantFactory,
|
||||
} from "./simple-product-variant-factory"
|
||||
import {
|
||||
SalesChannelFactoryData,
|
||||
simpleSalesChannelFactory
|
||||
simpleSalesChannelFactory,
|
||||
} from "./simple-sales-channel-factory"
|
||||
|
||||
export type ProductFactoryData = {
|
||||
@@ -28,6 +28,7 @@ export type ProductFactoryData = {
|
||||
options?: { id: string; title: string }[]
|
||||
variants?: ProductVariantFactoryData[]
|
||||
sales_channels?: SalesChannelFactoryData[]
|
||||
metadata?: Record<string, unknown>
|
||||
}
|
||||
|
||||
export const simpleProductFactory = async (
|
||||
@@ -83,6 +84,7 @@ export const simpleProductFactory = async (
|
||||
discountable: !data.is_giftcard,
|
||||
tags: [] as ProductTag[],
|
||||
profile_id: data.is_giftcard ? gcProfile?.id : defaultProfile?.id,
|
||||
metadata: data.metadata || null,
|
||||
} as Product
|
||||
|
||||
if (typeof data.tags !== "undefined") {
|
||||
|
||||
Reference in New Issue
Block a user