Skip to content

Commit

Permalink
fix: Adjust checks and typings so the build passes
Browse files Browse the repository at this point in the history
  • Loading branch information
sradevski committed Dec 11, 2024
1 parent 510b786 commit a02ef99
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/scripts/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,17 @@ import {
linkSalesChannelsToStockLocationWorkflow,
updateStoresWorkflow,
} from "@medusajs/medusa/core-flows";
import {
ExecArgs,
} from "@medusajs/framework/types";
import { CreateInventoryLevelInput, ExecArgs } from "@medusajs/framework/types";
import {
ContainerRegistrationKeys,
Modules,
ProductStatus
ProductStatus,
} from "@medusajs/framework/utils";

export default async function seedDemoData({ container }: ExecArgs) {
const logger = container.resolve(ContainerRegistrationKeys.LOGGER);
const remoteLink = container.resolve(
ContainerRegistrationKeys.REMOTE_LINK
);
const query = container.resolve(ContainerRegistrationKeys.QUERY)
const remoteLink = container.resolve(ContainerRegistrationKeys.REMOTE_LINK);
const query = container.resolve(ContainerRegistrationKeys.QUERY);
const fulfillmentModuleService = container.resolve(Modules.FULFILLMENT);
const salesChannelModuleService = container.resolve(Modules.SALES_CHANNEL);
const storeModuleService = container.resolve(Modules.STORE);
Expand Down Expand Up @@ -335,7 +331,7 @@ export default async function seedDemoData({ container }: ExecArgs) {
{
title: "Medusa T-Shirt",
category_ids: [
categoryResult.find((cat) => cat.name === "Shirts").id,
categoryResult.find((cat) => cat.name === "Shirts")!.id,
],
description:
"Reimagine the feeling of a classic T-shirt. With our cotton T-shirts, everyday essentials no longer have to be ordinary.",
Expand Down Expand Up @@ -521,7 +517,7 @@ export default async function seedDemoData({ container }: ExecArgs) {
{
title: "Medusa Sweatshirt",
category_ids: [
categoryResult.find((cat) => cat.name === "Sweatshirts").id,
categoryResult.find((cat) => cat.name === "Sweatshirts")!.id,
],
description:
"Reimagine the feeling of a classic sweatshirt. With our cotton sweatshirt, everyday essentials no longer have to be ordinary.",
Expand Down Expand Up @@ -620,7 +616,9 @@ export default async function seedDemoData({ container }: ExecArgs) {
},
{
title: "Medusa Sweatpants",
category_ids: [categoryResult.find((cat) => cat.name === "Pants").id],
category_ids: [
categoryResult.find((cat) => cat.name === "Pants")!.id,
],
description:
"Reimagine the feeling of classic sweatpants. With our cotton sweatpants, everyday essentials no longer have to be ordinary.",
handle: "sweatpants",
Expand Down Expand Up @@ -718,7 +716,9 @@ export default async function seedDemoData({ container }: ExecArgs) {
},
{
title: "Medusa Shorts",
category_ids: [categoryResult.find((cat) => cat.name === "Merch").id],
category_ids: [
categoryResult.find((cat) => cat.name === "Merch")!.id,
],
description:
"Reimagine the feeling of classic shorts. With our cotton shorts, everyday essentials no longer have to be ordinary.",
handle: "shorts",
Expand Down Expand Up @@ -822,25 +822,25 @@ export default async function seedDemoData({ container }: ExecArgs) {
logger.info("Seeding inventory levels.");

const { data: inventoryItems } = await query.graph({
entity: 'inventory_item',
fields: ['id']
})
entity: "inventory_item",
fields: ["id"],
});

const inventoryLevels = []
const inventoryLevels: CreateInventoryLevelInput[] = [];
for (const inventoryItem of inventoryItems) {
const inventoryLevel = {
location_id: stockLocation.id,
stocked_quantity: 1000000,
inventory_item_id: inventoryItem.id,
}
inventoryLevels.push(inventoryLevel)
};
inventoryLevels.push(inventoryLevel);
}

await createInventoryLevelsWorkflow(container).run({
input: {
inventory_levels: inventoryLevels
inventory_levels: inventoryLevels,
},
})
});

logger.info("Finished seeding inventory levels data.");
}

0 comments on commit a02ef99

Please sign in to comment.