docs: fix code block titles (#5733)

* docs: fix code block titles

* remove console

* fix build error
This commit is contained in:
Shahed Nasser
2023-11-27 16:08:10 +00:00
committed by GitHub
parent de8f748674
commit 547b16ead5
110 changed files with 483 additions and 456 deletions

View File

@@ -32,7 +32,7 @@ Fulfillment providers are loaded and installed on the backend startup.
The first step is to create a JavaScript or TypeScript file under `src/services`. For example, create the file `src/services/my-fulfillment.ts` with the following content:
```ts title=src/services/my-fulfillment.ts
```ts title="src/services/my-fulfillment.ts"
import {
AbstractFulfillmentService,
Cart,

View File

@@ -60,7 +60,7 @@ The first step to create a payment processor is to create a JavaScript or TypeSc
For example, create the file `src/services/my-payment-processor.ts` with the following content:
```ts title=src/services/my-payment-processor.ts
```ts title="src/services/my-payment-processor.ts"
import {
AbstractPaymentProcessor,
PaymentProcessorContext,

View File

@@ -19,7 +19,7 @@ This guide only explains how to override the cart completion strategy. Its hi
Create a TypeScript or JavaScript file in `src/strategies` of your Medusa backend project with a class that extends the `AbstractCartCompletionStrategy` class:
```ts title=src/strategies/cart-completion.ts
```ts title="src/strategies/cart-completion.ts"
import {
AbstractCartCompletionStrategy,
CartCompletionResponse,
@@ -52,7 +52,7 @@ You can use a constructor to access services and resources registered in the dep
<!-- eslint-disable prefer-rest-params -->
```ts title=src/strategies/cart-completion.ts
```ts title="src/strategies/cart-completion.ts"
// ...
import { IdempotencyKeyService } from "@medusajs/medusa"

View File

@@ -39,7 +39,7 @@ To subscribe to an event, you must create a [subscriber](../../../development/ev
Create the file `src/subscribers/customer-confirmation.ts` with the following content:
```ts title=src/subscribers/customer-confirmation.ts
```ts title="src/subscribers/customer-confirmation.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -70,7 +70,7 @@ In this method, you should typically send an email to the customer. You can plac
For example, you can implement this subscriber to send emails using [SendGrid](../../../plugins/notifications/sendgrid.mdx):
```ts title=src/subscribers/customer-confirmation.ts
```ts title="src/subscribers/customer-confirmation.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -117,7 +117,7 @@ If the notification provider youre using already implements the logic to hand
For example:
```ts title=src/loaders/customer-confirmation.ts
```ts title="src/loaders/customer-confirmation.ts"
import {
MedusaContainer,
NotificationService,

View File

@@ -41,7 +41,7 @@ To subscribe to and handle an event, you must create a [subscriber](../../../dev
Create the file `src/subscribers/gift-card.ts` with the following content:
```ts title=src/subscribers/gift-card.ts
```ts title="src/subscribers/gift-card.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -72,7 +72,7 @@ In this method, you should typically send an email to the customer. You can plac
For example, you can implement this subscriber to send emails using [SendGrid](../../../plugins/notifications/sendgrid.mdx):
```ts title=src/subscribers/gift-card.ts
```ts title="src/subscribers/gift-card.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -125,7 +125,7 @@ If the notification provider youre using already implements the logic to hand
For example:
```ts title=src/loaders/gift-card-event.ts
```ts title="src/loaders/gift-card-event.ts"
import {
MedusaContainer,
NotificationService,

View File

@@ -47,7 +47,7 @@ Create a file in the `src/services` directory that will hold your custom invento
In that file, add the following content:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
import {
CreateInventoryItemInput,
CreateInventoryLevelInput,
@@ -302,7 +302,7 @@ type InventoryItemDTO = {
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -360,7 +360,7 @@ type ReservationItemDTO = {
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -417,7 +417,7 @@ type InventoryLevelDTO = {
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -452,7 +452,7 @@ This method is expected to return the inventory item as an object.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -491,7 +491,7 @@ This method is expected to return the inventory level as an object.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -530,7 +530,7 @@ This method is expected to return the inventory level as an object.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -572,7 +572,7 @@ This method is expected to return the newly created reservation item.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -605,7 +605,7 @@ This method is expected to return the newly created inventory item.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -643,7 +643,7 @@ This method is expected to return the newly created inventory level.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -677,7 +677,7 @@ This method is expected to return the updated reservation item.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -719,7 +719,7 @@ This method is expected to return the updated inventory item.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -766,7 +766,7 @@ This method is expected to return the updated inventory level.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -810,7 +810,7 @@ This method is not expected to return anything.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -843,7 +843,7 @@ This method is not expected to return anything.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -878,7 +878,7 @@ This method is not expected to return anything.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -913,7 +913,7 @@ This method is not expected to return anything.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -947,7 +947,7 @@ This method is not expected to return anything.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -984,7 +984,7 @@ This method is not expected to return anything.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -1021,7 +1021,7 @@ This method is expected to return the updated location level.
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -1074,7 +1074,7 @@ This method is expected to return a boolean value indicating whether the invento
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -1110,7 +1110,7 @@ This method is expected to return a number being the available quantity of the i
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -1143,7 +1143,7 @@ This method is expected to return a number being the stocked quantity of the ite
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()
@@ -1176,7 +1176,7 @@ This method is expected to return a number being the reserved quantity of the it
For example:
```ts title=src/services/inventory.ts
```ts title="src/services/inventory.ts"
class InventoryService implements IInventoryService {
// ...
@InjectEntityManager()

View File

@@ -47,7 +47,7 @@ Create a file in the `src/services` directory that will hold your custom stock l
In that file, add the following content:
```ts title=src/services/stock-location.ts
```ts title="src/services/stock-location.ts"
import {
CreateStockLocationInput,
FilterableStockLocationProps,
@@ -168,7 +168,7 @@ type StockLocationDTO = {
Heres an example implementation of the method:
```ts title=src/services/stock-location.ts
```ts title="src/services/stock-location.ts"
class StockLocationService implements IStockLocationService {
// ...
@InjectEntityManager()
@@ -199,7 +199,7 @@ It accepts the exact same parameters as the [list method](#implementing-list-met
Heres an example implementation of the method:
```ts title=src/services/stock-location.ts
```ts title="src/services/stock-location.ts"
class StockLocationService implements IStockLocationService {
// ...
@InjectEntityManager()
@@ -234,7 +234,7 @@ This method returns the location as an object.
For example:
```ts title=src/services/stock-location.ts
```ts title="src/services/stock-location.ts"
class StockLocationService implements IStockLocationService {
// ...
@InjectEntityManager()
@@ -275,7 +275,7 @@ The method is expected to return the created location as an object.
For example:
```ts title=src/services/stock-location.ts
```ts title="src/services/stock-location.ts"
class StockLocationService implements IStockLocationService {
// ...
@InjectEntityManager()
@@ -313,7 +313,7 @@ This method is expected to return the updated location object.
For example:
```ts title=src/services/stock-location.ts
```ts title="src/services/stock-location.ts"
class StockLocationService implements IStockLocationService {
// ...
@InjectEntityManager()
@@ -348,7 +348,7 @@ This method is not expected to return anything.
For example:
```ts title=src/services/stock-location.ts
```ts title="src/services/stock-location.ts"
class StockLocationService implements IStockLocationService {
// ...
@InjectEntityManager()

View File

@@ -45,7 +45,7 @@ You can learn more about subscribers in the [Subscribers documentation](../../
Create the file `src/subscribers/order-claim.ts` with the following content:
```ts title=src/subscribers/order-claim.ts
```ts title="src/subscribers/order-claim.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -88,7 +88,7 @@ In this method, you should typically send an email to the customer. You can plac
For example, you can implement this subscriber to send emails using SendGrid:
```ts title=src/subscribers/order-claim.ts
```ts title="src/subscribers/order-claim.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -129,7 +129,7 @@ If the notification provider youre using already implements the logic to hand
For example:
```ts title=src/loaders/order-claim.ts
```ts title="src/loaders/order-claim.ts"
import {
MedusaContainer,
NotificationService,

View File

@@ -37,7 +37,7 @@ To subscribe to an event, you must create a [subscriber](../../../development/ev
Create the file `src/subscribers/order-placed.ts` with the following content:
```ts title=src/subscribers/order-placed.ts
```ts title="src/subscribers/order-placed.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -74,7 +74,7 @@ This example is only used to illustrate how the functionality can be implemented
For example, you can implement this subscriber to send emails using [SendGrid](../../../plugins/notifications/sendgrid.mdx):
```ts title=src/subscribers/order-placed.ts
```ts title="src/subscribers/order-placed.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -129,7 +129,7 @@ If the notification provider youre using already implements the logic to hand
For example:
```ts title=src/loaders/customer-confirmation.ts
```ts title="src/loaders/customer-confirmation.ts"
import {
MedusaContainer,
NotificationService,

View File

@@ -25,7 +25,7 @@ Medusa provides the necessary features to build a customizable shopping experien
<LargeCardList colSize={6}>
<LargeCard
Icon={Icons['check-circle-solid']}
title='Orders'
title="'Orders'"
action={{
label: 'Learn more',
href: '/modules/orders/overview'
@@ -42,7 +42,7 @@ Medusa provides the necessary features to build a customizable shopping experien
</LargeCard>
<LargeCard
Icon={Icons['building-solid']}
title='Inventory (Multi-Warehouse)'
title="'Inventory (Multi-Warehouse)'"
action={{
label: 'Learn more',
href: '/modules/multiwarehouse/overview'
@@ -57,7 +57,7 @@ Medusa provides the necessary features to build a customizable shopping experien
</LargeCard>
<LargeCard
Icon={Icons['shopping-cart-solid']}
title='Cart and Checkout'
title="'Cart and Checkout'"
action={{
label: 'Learn more',
href: '/modules/carts-and-checkout/overview'
@@ -73,7 +73,7 @@ Medusa provides the necessary features to build a customizable shopping experien
</LargeCard>
<LargeCard
Icon={Icons['users-solid']}
title='Customers'
title="'Customers'"
action={{
label: 'Learn more',
href: '/modules/customers/overview'
@@ -95,7 +95,7 @@ Medusa's products configuration allows managing products of different types incl
<LargeCardList colSize={6}>
<LargeCard
Icon={Icons['tag-solid']}
title='Products'
title="'Products'"
action={{
label: 'Learn more',
href: '/modules/products/overview'
@@ -112,7 +112,7 @@ Medusa's products configuration allows managing products of different types incl
</LargeCard>
<LargeCard
Icon={Icons['gift-solid']}
title='Gift Cards'
title="'Gift Cards'"
action={{
label: 'Learn more',
href: '/modules/gift-cards/overview'
@@ -129,7 +129,7 @@ Medusa's products configuration allows managing products of different types incl
<LargeCard
Icon={Icons['currency-dollar-solid']}
title='Price Lists'
title="'Price Lists'"
action={{
label: 'Learn more',
href: '/modules/price-lists/overview'
@@ -146,7 +146,7 @@ Medusa's products configuration allows managing products of different types incl
<LargeCard
Icon={Icons['receipt-percent']}
title='Discounts'
title="'Discounts'"
action={{
label: 'Learn more',
href: '/modules/discounts/overview'
@@ -169,7 +169,7 @@ Medusa's multi-region setup and sales channels allow businesses to sell internat
<LargeCardList colSize={6}>
<LargeCard
Icon={Icons['globe-europe-solid']}
title='Region and Currencies'
title="'Region and Currencies'"
action={{
label: 'Learn more',
href: '/modules/regions-and-currencies/overview'
@@ -185,7 +185,7 @@ Medusa's multi-region setup and sales channels allow businesses to sell internat
</LargeCard>
<LargeCard
Icon={Icons['cash-solid']}
title='Taxes'
title="'Taxes'"
action={{
label: 'Learn more',
href: '/modules/taxes/overview'
@@ -203,7 +203,7 @@ Medusa's multi-region setup and sales channels allow businesses to sell internat
<LargeCard
Icon={Icons['channels-solid']}
title='Sales Channels'
title="'Sales Channels'"
action={{
label: 'Learn more',
href: '/modules/sales-channels/overview'

View File

@@ -19,7 +19,7 @@ If youre interested in learning what a price selection strategy is and how it
Create a TypeScript or JavaScript file in `src/strategies` of your Medusa backend project with a class that extends the `AbstractPriceSelectionStrategy` class:
```ts title=src/strategies/price.ts
```ts title="src/strategies/price.ts"
import {
AbstractPriceSelectionStrategy,
PriceSelectionContext,
@@ -51,7 +51,7 @@ You can resolve resources like services or repositories using [dependency inject
For example:
```ts title=src/strategies/price.ts
```ts title="src/strategies/price.ts"
import {
AbstractPriceSelectionStrategy,
CustomerService,

View File

@@ -90,7 +90,7 @@ If you are using an existing Medusa database, you can skip this step.
Migrations are used to create your database schema. Before you can run migrations, add in your `package.json` the following scripts:
```json title=package.json
```json title="package.json"
"scripts": {
//...other scripts
"product:migrations:run": "medusa-product-migrations-up",
@@ -103,7 +103,7 @@ The first command runs the migrations, and the second command allows you to opti
<Details>
<Summary>Seed file</Summary>
```js title=seed-data.js
```js title="seed-data.js"
const productCategoriesData = [
{
id: "category-0",
@@ -210,7 +210,7 @@ Next.js uses Webpack for compilation. Since quite a few of the dependencies used
To do that, add the `serverComponentsExternalPackages` option in `next.config.js`:
```js title=next.config.js
```js title="next.config.js"
/** @type {import('next').NextConfig} */
const nextConfig = {
experimental: {
@@ -235,7 +235,7 @@ This guide uses Next.js's App Router.
For example, create the file `app/api/products/route.ts` with the following content:
```ts title=app/api/products/route.ts
```ts title="app/api/products/route.ts"
import { NextResponse } from "next/server"
import {
@@ -271,7 +271,7 @@ This section includes some examples of the different functionalities or ways you
### List Products
```ts title=app/api/products/route.ts
```ts title="app/api/products/route.ts"
import { NextResponse } from "next/server"
import {
@@ -289,7 +289,7 @@ export async function GET(request: Request) {
### Retrieve Product by Id
```ts title=app/api/product/[id]/route.ts
```ts title="app/api/product/[id]/route.ts"
import { NextResponse } from "next/server"
import {
@@ -313,7 +313,7 @@ export async function GET(
### Retrieve Product by Handle
```ts title=app/api/product/[handle]/route.ts
```ts title="app/api/product/[handle]/route.ts"
import { NextResponse } from "next/server"
import {
@@ -337,7 +337,7 @@ export async function GET(
### Retrieve Categories
```ts title=app/api/categories/route.ts
```ts title="app/api/categories/route.ts"
import { NextResponse } from "next/server"
import {
@@ -355,7 +355,7 @@ export async function GET(request: Request) {
### Retrieve Category by Handle
```ts title=app/api/category/[handle]/route.ts
```ts title="app/api/category/[handle]/route.ts"
import { NextResponse } from "next/server"
import {

View File

@@ -19,7 +19,7 @@ A tax provider class should be defined in a TypeScript or JavaScript file under
For example, you can create the file `src/services/my-tax.ts` with the following content:
```ts title=src/services/my-tax.ts
```ts title="src/services/my-tax.ts"
import {
AbstractTaxService,
ItemTaxCalculationLine,
@@ -49,7 +49,7 @@ Since the class extends `AbstractTaxService`, it must implement its abstract met
You can use a constructor to access services and resources registered in the dependency container using dependency injection. For example:
```ts title=src/services/my-tax.ts
```ts title="src/services/my-tax.ts"
// ...
import { LineItemService } from "@medusajs/medusa"
@@ -79,7 +79,7 @@ Every tax provider must have a unique identifier. The identifier is defined as a
Add the static property `identifier` in your tax provider class:
```ts title=src/services/my-tax.ts
```ts title="src/services/my-tax.ts"
class MyTaxService extends AbstractTaxService {
static identifier = "my-tax"
// ...
@@ -161,7 +161,7 @@ The Medusa backend determines whether an object in the returned array is a shipp
For example, the `system` tax provider returns the tax calculation line items in the first parameter and the tax calculation shipping methods in the second parameter as is:
```ts title=src/services/my-tax.ts
```ts title="src/services/my-tax.ts"
// ...
class SystemTaxService extends AbstractTaxService {

View File

@@ -21,7 +21,7 @@ A tax calculation strategy should be defined in a TypeScript or JavaScript file
For example, you can create the file `src/strategies/tax-calculation.ts` with the following content:
```ts title=src/strategies/tax-calculation.ts
```ts title="src/strategies/tax-calculation.ts"
import {
ITaxCalculationStrategy,
LineItem,
@@ -52,7 +52,7 @@ Note that you add a basic implementation of the `calculate` method because it
You can use a constructor to access services and resources registered in the dependency container using dependency injection. For example:
```ts title=src/strategies/tax-calculation.ts
```ts title="src/strategies/tax-calculation.ts"
// ...
import {
LineItemService,

View File

@@ -52,7 +52,7 @@ You can learn how to [retrieve and use services](../../../development/services/c
Another way you can use the `CartService` to calculate taxes is using the method `decorateTotals`:
```ts title=src/api/store/line-taxes/[cart_id]/route.ts
```ts title="src/api/store/line-taxes/[cart_id]/route.ts"
import { CartService } from "@medusajs/medusa"
import type {
MedusaRequest,

View File

@@ -56,7 +56,7 @@ So, the first step would be to create the `Role` and `Permission` entities to re
Create the file `src/models/role.ts` with the following content:
```ts title=src/models/role.ts
```ts title="src/models/role.ts"
import {
BeforeInsert,
Column,
@@ -129,7 +129,7 @@ So, the first step would be to create the `Role` and `Permission` entities to re
Then, create the file `src/repositories/role.ts` with the following content:
```ts title=src/repositories/role.ts
```ts title="src/repositories/role.ts"
import { Role } from "../models/role"
import {
dataSource,
@@ -143,7 +143,7 @@ So, the first step would be to create the `Role` and `Permission` entities to re
Next, create the file `src/models/permission.ts` with the following content:
```ts title=src/models/permission.ts
```ts title="src/models/permission.ts"
import {
BeforeInsert,
Column,
@@ -182,7 +182,7 @@ So, the first step would be to create the `Role` and `Permission` entities to re
Then, create the file `src/repositories/permission.ts` with the following content:
```ts title=src/repositories/permission.ts
```ts title="src/repositories/permission.ts"
import { Permission } from "../models/permission"
import {
dataSource,
@@ -198,7 +198,7 @@ So, the first step would be to create the `Role` and `Permission` entities to re
Create the file `src/models/user.ts` with the following content:
```ts title=src/models/user.ts
```ts title="src/models/user.ts"
import {
Column,
Entity,
@@ -228,7 +228,7 @@ So, the first step would be to create the `Role` and `Permission` entities to re
Next, create the file `src/models/store.ts` with the following content:
```ts title=src/models/store.ts
```ts title="src/models/store.ts"
import { Entity, JoinColumn, OneToMany } from "typeorm"
import {
// alias the core entity to not cause a naming conflict
@@ -248,7 +248,7 @@ So, the first step would be to create the `Role` and `Permission` entities to re
Optionally, if youre using TypeScript, create the file `src/index.d.ts` with the following content:
```ts title=src/index.d.ts
```ts title="src/index.d.ts"
import { Role } from "./models/role"
export declare module "@medusajs/medusa/dist/models/user" {
@@ -272,7 +272,7 @@ So, the first step would be to create the `Role` and `Permission` entities to re
<!-- eslint-disable max-len -->
```ts title=src/migrations/1693225851284-AddRolesAndPermissions.ts
```ts title="src/migrations/1693225851284-AddRolesAndPermissions.ts"
import { MigrationInterface, QueryRunner, Table, TableIndex } from "typeorm"
export class AddRolesAndPermissions1693225851284 implements MigrationInterface {
@@ -352,7 +352,7 @@ Since the Medusa backend uses Express, you can create a middleware and attach it
Create the file `src/api/middlewares.ts` with the following content:
```ts title=src/api/middlewares.ts
```ts title="src/api/middlewares.ts"
import type {
MiddlewaresConfig,
UserService,
@@ -488,7 +488,7 @@ Furthermore, you may need to extend core services if you need to perform actions
Start by creating the file `src/services/permission.ts` with the following content:
```ts title=src/services/permission.ts
```ts title="src/services/permission.ts"
import { TransactionBaseService } from "@medusajs/medusa"
import { Permission } from "../models/permission"
import PermissionRepository from "../repositories/permission"
@@ -533,7 +533,7 @@ Furthermore, you may need to extend core services if you need to perform actions
Next, create the file `src/services/user.ts` with the following content:
```ts title=src/services/user.ts
```ts title="src/services/user.ts"
import {
UserService as MedusaUserService, User,
} from "@medusajs/medusa"
@@ -556,7 +556,7 @@ Furthermore, you may need to extend core services if you need to perform actions
Then, create the file `src/services/role.ts` with the following content:
```ts title=src/services/role.ts
```ts title="src/services/role.ts"
import { TransactionBaseService } from "@medusajs/medusa"
import { Role } from "../models/role"
import RoleRepository from "../repositories/role"
@@ -661,7 +661,7 @@ Furthermore, you may need to extend core services if you need to perform actions
Start by creating the file `src/api/admin/roles/route.ts` with the following content:
```ts title=src/api/admin/roles/route.ts
```ts title="src/api/admin/roles/route.ts"
import type {
MedusaRequest,
MedusaResponse,
@@ -697,7 +697,7 @@ Furthermore, you may need to extend core services if you need to perform actions
Next, create the file `src/api/routes/admin/roles/[id]/user/[user_id]/route.ts` with the following content:
```ts title=src/api/routes/admin/roles/[id]/user/[user_id]/route.ts
```ts title="src/api/routes/admin/roles/[id]/user/[user_id]/route.ts"
import type {
MedusaRequest,
MedusaResponse,

View File

@@ -37,7 +37,7 @@ To subscribe to an event, you must create a [subscriber](../../../development/ev
Create the file `src/subscribers/invite-created.ts` with the following content:
```ts title=src/subscribers/invite-created.ts
```ts title="src/subscribers/invite-created.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -78,7 +78,7 @@ In this method, you should typically send an email to the user. You can place an
For example, you can implement this subscriber to send emails using SendGrid:
```ts title=src/subscribers/invite.ts
```ts title="src/subscribers/invite.ts"
import {
type SubscriberConfig,
type SubscriberArgs,
@@ -123,7 +123,7 @@ If the notification provider youre using already implements the logic to hand
For example:
```ts title=src/loaders/customer-confirmation.ts
```ts title="src/loaders/customer-confirmation.ts"
import {
MedusaContainer,
NotificationService,