Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Adjust checks and typings so the build passes #2536

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.");
}
Loading