|
@@ -24,6 +24,7 @@ import {
|
|
linkSalesChannelsToApiKeyWorkflow,
|
|
linkSalesChannelsToApiKeyWorkflow,
|
|
createProductCategoryWorkflow,
|
|
createProductCategoryWorkflow,
|
|
createProductsWorkflow,
|
|
createProductsWorkflow,
|
|
|
|
+ createTaxRegionsWorkflow
|
|
} from "@medusajs/core-flows"
|
|
} from "@medusajs/core-flows"
|
|
|
|
|
|
export default async function seedDemoData({
|
|
export default async function seedDemoData({
|
|
@@ -41,6 +42,16 @@ export default async function seedDemoData({
|
|
const salesChannelModuleService: ISalesChannelModuleService = container.resolve(
|
|
const salesChannelModuleService: ISalesChannelModuleService = container.resolve(
|
|
ModuleRegistrationName.SALES_CHANNEL
|
|
ModuleRegistrationName.SALES_CHANNEL
|
|
)
|
|
)
|
|
|
|
+
|
|
|
|
+ const countries = [
|
|
|
|
+ "gb",
|
|
|
|
+ "de",
|
|
|
|
+ "dk",
|
|
|
|
+ "se",
|
|
|
|
+ "fr",
|
|
|
|
+ "es",
|
|
|
|
+ "it"
|
|
|
|
+ ]
|
|
|
|
|
|
try {
|
|
try {
|
|
logger.info("Seeding region data...")
|
|
logger.info("Seeding region data...")
|
|
@@ -50,15 +61,7 @@ export default async function seedDemoData({
|
|
regions: [{
|
|
regions: [{
|
|
name: "Europe",
|
|
name: "Europe",
|
|
currency_code: "eur",
|
|
currency_code: "eur",
|
|
- countries: [
|
|
|
|
- "gb",
|
|
|
|
- "de",
|
|
|
|
- "dk",
|
|
|
|
- "se",
|
|
|
|
- "fr",
|
|
|
|
- "es",
|
|
|
|
- "it"
|
|
|
|
- ],
|
|
|
|
|
|
+ countries,
|
|
payment_providers: ["pp_system_default"]
|
|
payment_providers: ["pp_system_default"]
|
|
}]
|
|
}]
|
|
}
|
|
}
|
|
@@ -66,6 +69,15 @@ export default async function seedDemoData({
|
|
const region = regionResult[0]
|
|
const region = regionResult[0]
|
|
logger.info("Finished seeding regions.")
|
|
logger.info("Finished seeding regions.")
|
|
|
|
|
|
|
|
+ logger.info("Seeding tax regions...")
|
|
|
|
+ await createTaxRegionsWorkflow(container)
|
|
|
|
+ .run({
|
|
|
|
+ input: countries.map((country_code) => ({
|
|
|
|
+ country_code
|
|
|
|
+ }))
|
|
|
|
+ })
|
|
|
|
+ logger.info("Finished seeding tax regions.")
|
|
|
|
+
|
|
logger.info("Seeding fulfillment data...")
|
|
logger.info("Seeding fulfillment data...")
|
|
const {
|
|
const {
|
|
result: shippingProfileResult
|
|
result: shippingProfileResult
|
|
@@ -145,6 +157,11 @@ export default async function seedDemoData({
|
|
attribute: "enabled_in_store",
|
|
attribute: "enabled_in_store",
|
|
value: "true",
|
|
value: "true",
|
|
operator: "eq"
|
|
operator: "eq"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attribute: "is_return",
|
|
|
|
+ value: "false",
|
|
|
|
+ operator: "eq"
|
|
}
|
|
}
|
|
]
|
|
]
|
|
},
|
|
},
|
|
@@ -170,6 +187,11 @@ export default async function seedDemoData({
|
|
attribute: "enabled_in_store",
|
|
attribute: "enabled_in_store",
|
|
value: "true",
|
|
value: "true",
|
|
operator: "eq"
|
|
operator: "eq"
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ attribute: "is_return",
|
|
|
|
+ value: "false",
|
|
|
|
+ operator: "eq"
|
|
}
|
|
}
|
|
]
|
|
]
|
|
}
|
|
}
|