chore(feature-flags): Sales Channels enabled by default (#2966)

This commit is contained in:
Oliver Windall Juhl
2023-01-10 16:45:23 +00:00
committed by GitHub
parent cac81749ea
commit 3308766389
34 changed files with 372 additions and 498 deletions
@@ -4,7 +4,8 @@ import {
ProductTag,
ProductType,
ShippingProfile,
ShippingProfileType
ShippingProfileType,
Store
} from "@medusajs/medusa"
import faker from "faker"
import { Connection } from "typeorm"
@@ -56,6 +57,21 @@ export const simpleProductFactory = async (
await simpleSalesChannelFactory(connection, salesChannel)
)
)
} else {
const store = await manager.findOne(Store, {
relations: ["default_sales_channel"],
})
if (store?.default_sales_channel) {
sales_channels = [store.default_sales_channel]
} else {
const salesChannel = await simpleSalesChannelFactory(connection, {
id: `default-${Math.random() * 1000}`,
is_default: true,
})
sales_channels = [salesChannel]
}
}
const prodId = data.id || `simple-product-${Math.random() * 1000}`