docs: general improvements and additions (#12296)

This commit is contained in:
Shahed Nasser
2025-04-25 19:00:45 +03:00
committed by GitHub
parent e2a7dbb61b
commit 43d282da8b
32 changed files with 17403 additions and 16544 deletions
+6 -1
View File
@@ -25,7 +25,12 @@ npx medusa build
## Build Output
The `build` command outputs the production build in the `.medusa/server` directory, and the admin dashboard build in the `.medusa/server/public/admin`.
The `build` command creates a `.medusa` directory in the root of your project that contains your build assets. Don't commit this directory to your repository.
The `.medusa` directory contains the following directories:
- `.medusa/server`: Contains the production build of your Medusa application.
- `.medusa/server/public/admin`: Contains the production build of the admin dashboard.
### Separate Admin Build
@@ -60,7 +60,7 @@ export const highlights = [
]
```ts title="src/api/middlewares.ts" highlights={highlights}
import { defineMiddlewares } from "@medusajs/medusa";
import { defineMiddlewares } from "@medusajs/medusa"
export default defineMiddlewares({
routes: [
@@ -69,13 +69,13 @@ export default defineMiddlewares({
method: "GET",
middlewares: [
(req, res, next) => {
req.allowed?.push("b2b_company");
next();
req.allowed?.push("b2b_company")
next()
},
],
},
],
});
})
```
In this example, you apply a middleware to the [Get Customer Admin API Route](!api!/admin#customers_getcustomersid).
@@ -6,6 +6,12 @@ export const metadata = {
In this chapter, you'll learn how to manage relationships between data models when creating, updating, or retrieving records using the module's main service.
<Note>
This chapter applies to data model relationships within the same module. To manage linked data models across modules, check out [Links](../../module-links/page.mdx) and [Query](../../module-links/query/page.mdx).
</Note>
## Manage One-to-One Relationship
### BelongsTo Side of One-to-One
@@ -222,7 +222,7 @@ export const POST = async (
) => {
const { result } = await createPostWorkflow(req.scope)
.run({
input: result.validatedBody
input: result.validatedBody,
})
return res.json(result)
@@ -987,7 +987,7 @@ export default async function orderConfirmationJob(
await sendOrderConfirmationWorkflow(container).run({
input: {
id: "order_123",
}
},
})
}
export const config = {
@@ -436,7 +436,7 @@ export default class CmsModuleService {
filter: {
id: string | string[]
},
config?: FindConfig<any> | undefined,
config?: FindConfig<any> | undefined
) {
return this.client.getPosts(filter, {
limit: config?.take,
@@ -304,7 +304,7 @@ class BlogModuleService extends MedusaService({
protected postRepository_: DAL.RepositoryService<Post>
constructor({
postRepository
postRepository,
}: InjectedDependencies) {
super(...arguments)
this.postRepository_ = postRepository
@@ -334,7 +334,7 @@ class BlogModuleService {
protected postRepository_: DAL.RepositoryService<Post>
constructor({
postRepository
postRepository,
}: InjectedDependencies) {
super(...arguments)
this.postRepository_ = postRepository
@@ -144,11 +144,11 @@ export const skipOnPermanentFailureEnabledHighlights = [
```ts title="Workflow Equivalent" highlights={skipOnPermanentFailureEnabledHighlights}
import {
createWorkflow
createWorkflow,
} from "@medusajs/framework/workflows-sdk"
import {
actionThatThrowsError,
moreActions
moreActions,
} from "./steps"
export const myWorkflow = createWorkflow(
@@ -204,12 +204,12 @@ export const skipOnPermanentFailureStepHighlights = [
```ts title="Workflow Equivalent" highlights={skipOnPermanentFailureStepHighlights}
import {
createWorkflow
createWorkflow,
} from "@medusajs/framework/workflows-sdk"
import {
actionThatThrowsError,
moreActions,
continueExecutionFromStep
continueExecutionFromStep,
} from "./steps"
export const myWorkflow = createWorkflow(
@@ -278,11 +278,11 @@ export const continueOnPermanentFailureHighlights = [
```ts title="Workflow Equivalent" highlights={continueOnPermanentFailureHighlights}
import {
createWorkflow
createWorkflow,
} from "@medusajs/framework/workflows-sdk"
import {
actionThatThrowsError,
moreActions
moreActions,
} from "./steps"
export const myWorkflow = createWorkflow(
@@ -128,6 +128,9 @@ This directory is the central place for your custom development. It includes the
This file holds your [Medusa configurations](../configurations/medusa-config/page.mdx), such as your PostgreSQL database configurations.
### .medusa
The `.medusa` directory holds types and other files that are generated by Medusa when you run the `build` command. Don't modify any files or commit them to your repository.
---