fix(medusa): Allow deleting metadata fields (#3055)

This commit is contained in:
Kasper Fabricius Kristensen authored and GitHub committed 2023-01-19 11:34:13 +01:00
1 parent 6481b0c357
commit fcba705701
4 files changed
+57 -3

No files matched your search

@@ -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") {