diff --git a/www/apps/book/app/advanced-development/custom-cli-scripts/seed-data/page.mdx b/www/apps/book/app/advanced-development/custom-cli-scripts/seed-data/page.mdx index 15d1a9f4321d4..7e33c10d7d173 100644 --- a/www/apps/book/app/advanced-development/custom-cli-scripts/seed-data/page.mdx +++ b/www/apps/book/app/advanced-development/custom-cli-scripts/seed-data/page.mdx @@ -41,19 +41,19 @@ import { faker } from "@faker-js/faker" import { ContainerRegistrationKeys, Modules, - ProductStatus -} from "@medusajs/framework/utils"; + ProductStatus, +} from "@medusajs/framework/utils" import { createInventoryLevelsWorkflow, - createProductsWorkflow -} from "@medusajs/medusa/core-flows"; + createProductsWorkflow, +} from "@medusajs/medusa/core-flows" -export default async function seedDummyProducts ({ - container +export default async function seedDummyProducts({ + container, }: ExecArgs) { const salesChannelModuleService = container.resolve( Modules.SALES_CHANNEL - ); + ) const logger = container.resolve( ContainerRegistrationKeys.LOGGER ) @@ -61,13 +61,13 @@ export default async function seedDummyProducts ({ ContainerRegistrationKeys.QUERY ) - let defaultSalesChannel = await salesChannelModuleService + const defaultSalesChannel = await salesChannelModuleService .listSalesChannels({ name: "Default Sales Channel", - }); + }) - const sizeOptions = ["S", "M", "L", "XL"]; - const colorOptions = ["Black", "White"]; + const sizeOptions = ["S", "M", "L", "XL"] + const colorOptions = ["Black", "White"] const currency_code = "eur" const productsNum = 50 @@ -85,7 +85,7 @@ Next, replace the `TODO` with the following: ```ts title="src/scripts/demo-products.ts" const productsData = new Array(productsNum).fill(0).map((_, index) => { - const title = faker.commerce.product() + '_' + index + const title = faker.commerce.product() + "_" + index return { title, is_giftcard: true, @@ -104,12 +104,12 @@ const productsData = new Array(productsNum).fill(0).map((_, index) => { images: [ { url: faker.image.urlPlaceholder({ - text: title + text: title, }), }, { url: faker.image.urlPlaceholder({ - text: title + text: title, }), }, ], @@ -142,7 +142,7 @@ Then, replace the new `TODO` with the following: ```ts title="src/scripts/demo-products.ts" const { result: products } = await createProductsWorkflow(container).run({ input: { - products: productsData + products: productsData, }, }) @@ -156,16 +156,16 @@ You create the generated products using the `createProductsWorkflow` imported pr Only thing left is to create inventory levels for the products. So, replace the last `TODO` with the following: ```ts title="src/scripts/demo-products.ts" -logger.info("Seeding inventory levels."); +logger.info("Seeding inventory levels.") const { data: stockLocations } = await query.graph({ entity: "stock_location", - fields: ["id"] + fields: ["id"], }) const { data: inventoryItems } = await query.graph({ - entity: 'inventory_item', - fields: ['id'] + entity: "inventory_item", + fields: ["id"], }) const inventoryLevels = inventoryItems.map((inventoryItem) => ({ @@ -176,11 +176,11 @@ const inventoryLevels = inventoryItems.map((inventoryItem) => ({ await createInventoryLevelsWorkflow(container).run({ input: { - inventory_levels: inventoryLevels + inventory_levels: inventoryLevels, }, }) -logger.info("Finished seeding inventory levels data."); +logger.info("Finished seeding inventory levels data.") ``` You use Query to retrieve the stock location, to use the first location in the application, and the inventory items. diff --git a/www/apps/book/app/advanced-development/module-links/custom-columns/page.mdx b/www/apps/book/app/advanced-development/module-links/custom-columns/page.mdx index 802f20b3a380b..fd9a12f5f71d9 100644 --- a/www/apps/book/app/advanced-development/module-links/custom-columns/page.mdx +++ b/www/apps/book/app/advanced-development/module-links/custom-columns/page.mdx @@ -31,9 +31,9 @@ export default defineLink( extraColumns: { metadata: { type: "json", - } - } - } + }, + }, + }, } ) ``` @@ -94,16 +94,16 @@ Learn more about the remote link, how to resolve it, and its methods in [this ch ```ts await remoteLink.create({ [Modules.PRODUCT]: { - product_id: "123" + product_id: "123", }, HELLO_MODULE: { - my_custom_id: "321" + my_custom_id: "321", }, data: { metadata: { - test: true - } - } + test: true, + }, + }, }) ``` @@ -138,8 +138,8 @@ const { data } = await query.graph({ entity: productHelloLink.entryPoint, fields: ["metadata", "product.*", "my_custom.*"], filters: { - product_id: "prod_123" - } + product_id: "prod_123", + }, }) ``` @@ -160,15 +160,15 @@ For example: ```ts await remoteLink.create({ [Modules.PRODUCT]: { - product_id: "123" + product_id: "123", }, HELLO_MODULE: { - my_custom_id: "321" + my_custom_id: "321", }, data: { metadata: { - test: false - } - } + test: false, + }, + }, }) ``` diff --git a/www/apps/book/app/advanced-development/modules/db-operations/page.mdx b/www/apps/book/app/advanced-development/modules/db-operations/page.mdx index acb89f4d1eac0..05be717931706 100644 --- a/www/apps/book/app/advanced-development/modules/db-operations/page.mdx +++ b/www/apps/book/app/advanced-development/modules/db-operations/page.mdx @@ -36,7 +36,7 @@ export const methodsHighlight = [ // other imports... import { InjectManager, - MedusaContext + MedusaContext, } from "@medusajs/framework/utils" class HelloModuleService { @@ -99,7 +99,7 @@ export const opHighlights = [ import { InjectManager, InjectTransactionManager, - MedusaContext + MedusaContext, } from "@medusajs/framework/utils" import { Context } from "@medusajs/framework/types" import { EntityManager } from "@mikro-orm/knex" @@ -118,10 +118,10 @@ class HelloModuleService { await transactionManager.nativeUpdate( "my_custom", { - id: input.id + id: input.id, }, { - name: input.name + name: input.name, } ) @@ -307,7 +307,7 @@ export const repoHighlights = [ import { InjectManager, InjectTransactionManager, - MedusaContext + MedusaContext, } from "@medusajs/framework/utils" import { Context } from "@medusajs/framework/types" import { EntityManager } from "@mikro-orm/knex" @@ -327,10 +327,10 @@ class HelloModuleService { await transactionManager.nativeUpdate( "my_custom", { - id: input.id + id: input.id, }, { - name: input.name + name: input.name, } ) @@ -342,7 +342,7 @@ class HelloModuleService { return updatedRecord }, { - transaction: sharedContext.transactionManager + transaction: sharedContext.transactionManager, } ) } @@ -397,7 +397,7 @@ class HelloModuleService { // ... }, { - transaction: sharedContext.transactionManager + transaction: sharedContext.transactionManager, } ) } @@ -430,7 +430,7 @@ class HelloModuleService { // ... }, { - isolationLevel: IsolationLevel.READ_COMMITTED + isolationLevel: IsolationLevel.READ_COMMITTED, } ) } @@ -456,7 +456,7 @@ class HelloModuleService { // ... }, { - enableNestedTransactions: false + enableNestedTransactions: false, } ) }