docs: general improvements and additions (#12296)
This commit is contained in:
@@ -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.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ export const generatedEditDates = {
|
||||
"app/learn/fundamentals/workflows/long-running-workflow/page.mdx": "2025-03-28T07:02:34.467Z",
|
||||
"app/learn/fundamentals/workflows/constructor-constraints/page.mdx": "2025-04-24T13:18:24.184Z",
|
||||
"app/learn/fundamentals/data-models/write-migration/page.mdx": "2025-03-24T06:41:48.915Z",
|
||||
"app/learn/fundamentals/data-models/manage-relationships/page.mdx": "2025-03-18T15:09:18.688Z",
|
||||
"app/learn/fundamentals/data-models/manage-relationships/page.mdx": "2025-04-25T14:16:41.124Z",
|
||||
"app/learn/fundamentals/modules/remote-query/page.mdx": "2024-07-21T21:20:24+02:00",
|
||||
"app/learn/fundamentals/modules/options/page.mdx": "2025-03-18T15:12:34.510Z",
|
||||
"app/learn/fundamentals/data-models/relationships/page.mdx": "2025-03-18T07:52:07.421Z",
|
||||
@@ -67,7 +67,7 @@ export const generatedEditDates = {
|
||||
"app/learn/fundamentals/module-links/directions/page.mdx": "2025-03-17T12:52:06.161Z",
|
||||
"app/learn/fundamentals/module-links/page.mdx": "2025-04-17T08:50:17.036Z",
|
||||
"app/learn/fundamentals/module-links/query/page.mdx": "2025-04-18T11:13:02.240Z",
|
||||
"app/learn/fundamentals/modules/db-operations/page.mdx": "2025-04-23T14:24:37.910Z",
|
||||
"app/learn/fundamentals/modules/db-operations/page.mdx": "2025-04-25T14:26:25.000Z",
|
||||
"app/learn/fundamentals/modules/multiple-services/page.mdx": "2025-03-18T15:11:44.632Z",
|
||||
"app/learn/fundamentals/modules/page.mdx": "2025-03-18T07:51:09.049Z",
|
||||
"app/learn/debugging-and-testing/instrumentation/page.mdx": "2025-02-24T08:12:53.132Z",
|
||||
@@ -94,10 +94,10 @@ export const generatedEditDates = {
|
||||
"app/learn/fundamentals/data-models/infer-type/page.mdx": "2025-03-18T07:41:01.936Z",
|
||||
"app/learn/fundamentals/custom-cli-scripts/seed-data/page.mdx": "2024-12-09T14:38:06.385Z",
|
||||
"app/learn/fundamentals/environment-variables/page.mdx": "2025-03-11T08:55:03.343Z",
|
||||
"app/learn/build/page.mdx": "2024-12-09T11:05:17.383Z",
|
||||
"app/learn/build/page.mdx": "2025-04-25T12:34:33.914Z",
|
||||
"app/learn/deployment/general/page.mdx": "2025-04-17T08:29:09.878Z",
|
||||
"app/learn/fundamentals/workflows/multiple-step-usage/page.mdx": "2024-11-25T16:19:32.169Z",
|
||||
"app/learn/installation/page.mdx": "2025-04-18T10:42:42.598Z",
|
||||
"app/learn/installation/page.mdx": "2025-04-25T12:33:42.096Z",
|
||||
"app/learn/fundamentals/data-models/check-constraints/page.mdx": "2024-12-06T14:34:50.384Z",
|
||||
"app/learn/fundamentals/module-links/link/page.mdx": "2025-04-07T08:03:14.513Z",
|
||||
"app/learn/fundamentals/workflows/store-executions/page.mdx": "2025-04-17T08:29:10.166Z",
|
||||
@@ -115,9 +115,9 @@ export const generatedEditDates = {
|
||||
"app/learn/configurations/medusa-config/page.mdx": "2025-04-17T08:29:09.907Z",
|
||||
"app/learn/configurations/ts-aliases/page.mdx": "2025-02-11T16:57:46.683Z",
|
||||
"app/learn/production/worker-mode/page.mdx": "2025-03-11T15:21:50.906Z",
|
||||
"app/learn/fundamentals/module-links/read-only/page.mdx": "2025-04-18T11:09:13.328Z",
|
||||
"app/learn/fundamentals/module-links/read-only/page.mdx": "2025-04-25T14:26:25.000Z",
|
||||
"app/learn/fundamentals/data-models/properties/page.mdx": "2025-03-18T07:57:17.826Z",
|
||||
"app/learn/fundamentals/framework/page.mdx": "2025-04-17T16:07:19.090Z",
|
||||
"app/learn/fundamentals/api-routes/retrieve-custom-links/page.mdx": "2025-04-18T07:38:56.729Z",
|
||||
"app/learn/fundamentals/workflows/errors/page.mdx": "2025-04-24T14:47:13.368Z"
|
||||
"app/learn/fundamentals/framework/page.mdx": "2025-04-25T14:26:25.000Z",
|
||||
"app/learn/fundamentals/api-routes/retrieve-custom-links/page.mdx": "2025-04-25T14:26:25.000Z",
|
||||
"app/learn/fundamentals/workflows/errors/page.mdx": "2025-04-25T14:26:25.000Z"
|
||||
}
|
||||
+16727
-16507
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user