docs: replace ModuleRegistrationName with Modules (#9142)
This commit is contained in:
@@ -10,7 +10,7 @@ The Order Module is the `@medusajs/order` NPM package that provides order-relate
|
||||
|
||||
## How to Use Order Module's Service
|
||||
|
||||
You can use the Order Module's main service by resolving from the Medusa container the resource `ModuleRegistrationName.ORDER` imported from `@medusajs/utils`.
|
||||
You can use the Order Module's main service by resolving from the Medusa container the resource `Modules.ORDER` imported from `@medusajs/utils`.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -20,14 +20,14 @@ For example:
|
||||
```ts title="src/api/store/custom/route.ts"
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
|
||||
import { IOrderModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
|
||||
export async function GET(
|
||||
req: MedusaRequest,
|
||||
res: MedusaResponse
|
||||
): Promise<void> {
|
||||
const orderModuleService: IOrderModuleService = req.scope.resolve(
|
||||
ModuleRegistrationName.ORDER
|
||||
Modules.ORDER
|
||||
)
|
||||
|
||||
res.json({
|
||||
@@ -42,11 +42,11 @@ export async function GET(
|
||||
```ts title="src/subscribers/custom-handler.ts"
|
||||
import { SubscriberArgs } from "@medusajs/medusa"
|
||||
import { IOrderModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
|
||||
export default async function subscriberHandler({ container }: SubscriberArgs) {
|
||||
const orderModuleService: IOrderModuleService = container.resolve(
|
||||
ModuleRegistrationName.ORDER
|
||||
Modules.ORDER
|
||||
)
|
||||
|
||||
const orders = await orderModuleService.listOrders()
|
||||
@@ -59,11 +59,11 @@ export default async function subscriberHandler({ container }: SubscriberArgs) {
|
||||
```ts title="src/workflows/hello-world/step1.ts"
|
||||
import { createStep } from "@medusajs/workflows-sdk"
|
||||
import { IOrderModuleService } from "@medusajs/types"
|
||||
import { ModuleRegistrationName } from "@medusajs/utils"
|
||||
import { Modules } from "@medusajs/utils"
|
||||
|
||||
const step1 = createStep("step-1", async (_, { container }) => {
|
||||
const orderModuleService: IOrderModuleService = container.resolve(
|
||||
ModuleRegistrationName.ORDER
|
||||
Modules.ORDER
|
||||
)
|
||||
const orders = await orderModuleService.listOrders()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user