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
@@ -1,5 +1,6 @@
const Scrypt = require("scrypt-kdf")
const { User } = require("@medusajs/medusa")
const { simpleSalesChannelFactory } = require("../factories")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
@@ -15,6 +15,7 @@ const {
DiscountRule,
Payment,
} = require("@medusajs/medusa")
const { simpleSalesChannelFactory } = require("../factories")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
@@ -23,6 +24,11 @@ module.exports = async (connection, data = {}) => {
type: "default",
})
const salesChannel = await simpleSalesChannelFactory(connection, {
id: "sales-channel",
is_default: true,
})
await manager.insert(Product, {
id: "test-product",
title: "test product",
@@ -30,6 +36,10 @@ module.exports = async (connection, data = {}) => {
options: [{ id: "test-option", title: "Size" }],
})
await manager.query(
`insert into product_sales_channel values ('test-product', '${salesChannel.id}');`
)
await manager.insert(Address, {
id: "oli-shipping",
first_name: "oli",
@@ -44,6 +54,10 @@ module.exports = async (connection, data = {}) => {
options: [{ id: "test-option-color", title: "Color" }],
})
await manager.query(
`insert into product_sales_channel values ('test-product-2', '${salesChannel.id}');`
)
await manager.insert(ProductVariant, {
id: "test-variant",
title: "test variant",
@@ -14,6 +14,7 @@ const {
ShippingProfile,
Swap,
} = require("@medusajs/medusa")
const { simpleSalesChannelFactory } = require("../factories")
module.exports = async (connection, data = {}) => {
const manager = connection.manager
@@ -22,6 +23,11 @@ module.exports = async (connection, data = {}) => {
type: "default",
})
const salesChannel = await simpleSalesChannelFactory(connection, {
id: "test-channel",
is_default: true,
})
await manager.insert(Product, {
id: "test-product",
title: "test product",
@@ -29,6 +35,10 @@ module.exports = async (connection, data = {}) => {
options: [{ id: "test-option", title: "Size" }],
})
await manager.query(
`insert into product_sales_channel values ('test-product', '${salesChannel.id}');`
)
await manager.insert(ProductVariant, {
id: "test-variant",
title: "test variant",
@@ -8,6 +8,7 @@ const {
ShippingProfile,
ProductVariant,
Image,
Store,
} = require("@medusajs/medusa")
module.exports = async (connection, data = {}) => {