docs: general updates after 2.5.0 update (#11402)
This commit is contained in:
@@ -288,7 +288,7 @@ const columns = [
|
||||
}),
|
||||
columnHelper.accessor("name", {
|
||||
header: "Name",
|
||||
})
|
||||
}),
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
+20
-20
@@ -337,10 +337,10 @@ medusaIntegrationTestRunner({
|
||||
{
|
||||
type: "publishable",
|
||||
title: "Test Key",
|
||||
created_by: ""
|
||||
}
|
||||
]
|
||||
}
|
||||
created_by: "",
|
||||
},
|
||||
],
|
||||
},
|
||||
})).result[0]
|
||||
})
|
||||
describe("GET /custom", () => {
|
||||
@@ -349,8 +349,8 @@ medusaIntegrationTestRunner({
|
||||
`/store/custom`,
|
||||
{
|
||||
headers: {
|
||||
"x-publishable-api-key": pak.token
|
||||
}
|
||||
"x-publishable-api-key": pak.token,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -421,13 +421,13 @@ medusaIntegrationTestRunner({
|
||||
provider: "emailpass",
|
||||
entity_id: "admin@medusa.js",
|
||||
provider_metadata: {
|
||||
password: "supersecret"
|
||||
}
|
||||
}
|
||||
password: "supersecret",
|
||||
},
|
||||
},
|
||||
],
|
||||
app_metadata: {
|
||||
user_id: user.id
|
||||
}
|
||||
user_id: user.id,
|
||||
},
|
||||
})
|
||||
|
||||
const token = jwt.sign(
|
||||
@@ -503,13 +503,13 @@ medusaIntegrationTestRunner({
|
||||
provider: "emailpass",
|
||||
entity_id: "customer@medusa.js",
|
||||
provider_metadata: {
|
||||
password: "supersecret"
|
||||
}
|
||||
}
|
||||
password: "supersecret",
|
||||
},
|
||||
},
|
||||
],
|
||||
app_metadata: {
|
||||
user_id: customer.id
|
||||
}
|
||||
user_id: customer.id,
|
||||
},
|
||||
})
|
||||
|
||||
const token = jwt.sign(
|
||||
@@ -533,10 +533,10 @@ medusaIntegrationTestRunner({
|
||||
{
|
||||
type: "publishable",
|
||||
title: "Test Key",
|
||||
created_by: ""
|
||||
}
|
||||
]
|
||||
}
|
||||
created_by: "",
|
||||
},
|
||||
],
|
||||
},
|
||||
})).result[0]
|
||||
|
||||
headers["x-publishable-api-key"] = pak.token
|
||||
|
||||
+1
-1
@@ -126,7 +126,7 @@ medusaIntegrationTestRunner({
|
||||
it("returns message", async () => {
|
||||
const { errors } = await helloWorldWorkflow(getContainer())
|
||||
.run({
|
||||
throwOnError: false
|
||||
throwOnError: false,
|
||||
})
|
||||
|
||||
expect(errors.length).toBeGreaterThan(0)
|
||||
|
||||
@@ -10,59 +10,59 @@ In this chapter, you'll learn how to manage relationships between data models wh
|
||||
|
||||
### BelongsTo Side of One-to-One
|
||||
|
||||
When you create a record of a data model that belongs to another through a one-to-one relation, pass the ID of the other data model's record in the relation property.
|
||||
When you create a record of a data model that belongs to another through a one-to-one relation, pass the ID of the other data model's record in the `{relation}_id` property, where `{relation}` is the name of the relation property.
|
||||
|
||||
For example, assuming you have the [User and Email data models from the previous chapter](../relationships/page.mdx#one-to-one-relationship), set an email's user ID as follows:
|
||||
|
||||
export const belongsHighlights = [
|
||||
["4", "user", "The ID of the user the email belongs to."],
|
||||
["11", "user", "The ID of the user the email belongs to."]
|
||||
["4", "user_id", "The ID of the user the email belongs to."],
|
||||
["11", "user_id", "The ID of the user the email belongs to."]
|
||||
]
|
||||
|
||||
```ts highlights={belongsHighlights}
|
||||
// when creating an email
|
||||
const email = await helloModuleService.createEmails({
|
||||
// other properties...
|
||||
user: "123",
|
||||
user_id: "123",
|
||||
})
|
||||
|
||||
// when updating an email
|
||||
const email = await helloModuleService.updateEmails({
|
||||
id: "321",
|
||||
// other properties...
|
||||
user: "123",
|
||||
user_id: "123",
|
||||
})
|
||||
```
|
||||
|
||||
In the example above, you pass the `user` property when creating or updating an email to specify the user it belongs to.
|
||||
In the example above, you pass the `user_id` property when creating or updating an email to specify the user it belongs to.
|
||||
|
||||
### HasOne Side
|
||||
|
||||
When you create a record of a data model that has one of another, pass the ID of the other data model's record in the relation property.
|
||||
When you create a record of a data model that has one of another, pass the ID of the other data model's record in the `{relation}_id` property, where `{relation}` is the name of the relation property.
|
||||
|
||||
For example, assuming you have the [User and Email data models from the previous chapter](../relationships/page.mdx#one-to-one-relationship), set a user's email ID as follows:
|
||||
|
||||
export const hasOneHighlights = [
|
||||
["4", "email", "The ID of the email that the user has."],
|
||||
["11", "email", "The ID of the email that the user has."]
|
||||
["4", "email_id", "The ID of the email that the user has."],
|
||||
["11", "email_id", "The ID of the email that the user has."]
|
||||
]
|
||||
|
||||
```ts highlights={hasOneHighlights}
|
||||
// when creating a user
|
||||
const user = await helloModuleService.createUsers({
|
||||
// other properties...
|
||||
email: "123",
|
||||
email_id: "123",
|
||||
})
|
||||
|
||||
// when updating a user
|
||||
const user = await helloModuleService.updateUsers({
|
||||
id: "321",
|
||||
// other properties...
|
||||
email: "123",
|
||||
email_id: "123",
|
||||
})
|
||||
```
|
||||
|
||||
In the example above, you pass the `email` property when creating or updating a user to specify the email it has.
|
||||
In the example above, you pass the `email_id` property when creating or updating a user to specify the email it has.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ const { data } = await query.graph({
|
||||
fields: ["*"],
|
||||
context: QueryContext({
|
||||
lang: "es",
|
||||
})
|
||||
}),
|
||||
})
|
||||
```
|
||||
|
||||
@@ -58,7 +58,7 @@ import Author from "./models/author"
|
||||
|
||||
class BlogModuleService extends MedusaService({
|
||||
Post,
|
||||
Author
|
||||
Author,
|
||||
}){
|
||||
// @ts-ignore
|
||||
async listPosts(
|
||||
@@ -125,8 +125,8 @@ const { data } = await query.graph({
|
||||
lang: "es",
|
||||
author: QueryContext({
|
||||
lang: "es",
|
||||
})
|
||||
})
|
||||
}),
|
||||
}),
|
||||
})
|
||||
```
|
||||
|
||||
@@ -144,7 +144,7 @@ import Author from "./models/author"
|
||||
|
||||
class BlogModuleService extends MedusaService({
|
||||
Post,
|
||||
Author
|
||||
Author,
|
||||
}){
|
||||
// @ts-ignore
|
||||
async listPosts(
|
||||
@@ -168,7 +168,7 @@ class BlogModuleService extends MedusaService({
|
||||
author: {
|
||||
...post.author,
|
||||
name: isAuthorLangEs ? post.author.name + " en español" : post.author.name,
|
||||
}
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -201,8 +201,8 @@ const { data } = await query.graph({
|
||||
context: {
|
||||
post: QueryContext({
|
||||
lang: "es",
|
||||
})
|
||||
}
|
||||
}),
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ import { createStep, createWorkflow } from "@medusajs/framework/workflows-sdk"
|
||||
|
||||
const step1 = createStep(
|
||||
{
|
||||
name: "step-1"
|
||||
name: "step-1",
|
||||
},
|
||||
async () => {
|
||||
console.log("Hello from step 1")
|
||||
@@ -61,7 +61,7 @@ export const helloWorkflow = createWorkflow(
|
||||
{
|
||||
name: "hello-workflow",
|
||||
retentionTime: 99999,
|
||||
store: true
|
||||
store: true,
|
||||
},
|
||||
() => {
|
||||
step1()
|
||||
@@ -98,8 +98,8 @@ export const retrieveHighlights = [
|
||||
]
|
||||
|
||||
```ts title="src/workflows/[id]/route.ts" highlights={retrieveHighlights}
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework";
|
||||
import { Modules } from "@medusajs/framework/utils";
|
||||
import { MedusaRequest, MedusaResponse } from "@medusajs/framework"
|
||||
import { Modules } from "@medusajs/framework/utils"
|
||||
|
||||
export async function GET(
|
||||
req: MedusaRequest,
|
||||
@@ -112,11 +112,11 @@ export async function GET(
|
||||
)
|
||||
|
||||
const [workflowExecution] = await workflowEngineService.listWorkflowExecutions({
|
||||
transaction_id: transaction_id
|
||||
transaction_id: transaction_id,
|
||||
})
|
||||
|
||||
res.json({
|
||||
workflowExecution
|
||||
workflowExecution,
|
||||
})
|
||||
}
|
||||
```
|
||||
@@ -165,7 +165,7 @@ To check if a stored workflow execution failed, you can check its `state` proper
|
||||
```ts
|
||||
if (workflowExecution.state === "failed") {
|
||||
return res.status(500).json({
|
||||
error: "Workflow failed"
|
||||
error: "Workflow failed",
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
@@ -38,7 +38,7 @@ export const generatedEditDates = {
|
||||
"app/learn/fundamentals/workflows/long-running-workflow/page.mdx": "2025-01-27T08:45:19.028Z",
|
||||
"app/learn/fundamentals/workflows/constructor-constraints/page.mdx": "2024-12-12T15:09:41.179Z",
|
||||
"app/learn/fundamentals/data-models/write-migration/page.mdx": "2024-11-11T15:27:59.794Z",
|
||||
"app/learn/fundamentals/data-models/manage-relationships/page.mdx": "2024-12-12T14:23:26.254Z",
|
||||
"app/learn/fundamentals/data-models/manage-relationships/page.mdx": "2025-02-11T15:53:12.541Z",
|
||||
"app/learn/fundamentals/modules/remote-query/page.mdx": "2024-07-21T21:20:24+02:00",
|
||||
"app/learn/fundamentals/modules/options/page.mdx": "2025-01-16T09:21:38.244Z",
|
||||
"app/learn/fundamentals/data-models/relationships/page.mdx": "2025-02-03T08:01:18.094Z",
|
||||
@@ -59,9 +59,9 @@ export const generatedEditDates = {
|
||||
"app/learn/fundamentals/data-models/index/page.mdx": "2024-10-21T13:30:21.368Z",
|
||||
"app/learn/fundamentals/custom-cli-scripts/page.mdx": "2024-10-23T07:08:55.898Z",
|
||||
"app/learn/fundamentals/data-models/property-types/page.mdx": "2024-12-12T10:41:32.999Z",
|
||||
"app/learn/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx": "2025-02-07T12:16:51.237Z",
|
||||
"app/learn/debugging-and-testing/testing-tools/integration-tests/api-routes/page.mdx": "2025-02-11T15:56:03.835Z",
|
||||
"app/learn/debugging-and-testing/testing-tools/integration-tests/page.mdx": "2024-12-09T15:52:01.019Z",
|
||||
"app/learn/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx": "2025-01-31T13:19:02.586Z",
|
||||
"app/learn/debugging-and-testing/testing-tools/integration-tests/workflows/page.mdx": "2025-02-11T15:56:03.835Z",
|
||||
"app/learn/debugging-and-testing/testing-tools/page.mdx": "2025-01-31T13:19:02.587Z",
|
||||
"app/learn/debugging-and-testing/testing-tools/unit-tests/module-example/page.mdx": "2024-09-02T11:04:27.232Z",
|
||||
"app/learn/debugging-and-testing/testing-tools/unit-tests/page.mdx": "2024-09-02T11:03:26.997Z",
|
||||
@@ -88,7 +88,7 @@ export const generatedEditDates = {
|
||||
"app/learn/customization/extend-features/extend-create-product/page.mdx": "2025-01-06T11:18:58.250Z",
|
||||
"app/learn/customization/custom-features/page.mdx": "2024-12-09T10:46:28.593Z",
|
||||
"app/learn/customization/customize-admin/page.mdx": "2024-12-09T11:02:38.801Z",
|
||||
"app/learn/customization/customize-admin/route/page.mdx": "2025-02-05T09:09:11.472Z",
|
||||
"app/learn/customization/customize-admin/route/page.mdx": "2025-02-11T15:56:03.835Z",
|
||||
"app/learn/customization/customize-admin/widget/page.mdx": "2025-02-05T09:10:18.163Z",
|
||||
"app/learn/customization/extend-features/define-link/page.mdx": "2024-12-09T11:02:39.346Z",
|
||||
"app/learn/customization/extend-features/page.mdx": "2024-12-09T11:02:39.244Z",
|
||||
@@ -110,11 +110,11 @@ export const generatedEditDates = {
|
||||
"app/learn/fundamentals/data-models/check-constraints/page.mdx": "2024-12-06T14:34:50.384Z",
|
||||
"app/learn/fundamentals/module-links/link/page.mdx": "2025-01-06T09:27:25.604Z",
|
||||
"app/learn/conventions/ts-aliases/page.mdx": "2025-01-23T15:01:15.403Z",
|
||||
"app/learn/fundamentals/workflows/store-executions/page.mdx": "2025-01-27T08:45:19.028Z",
|
||||
"app/learn/fundamentals/workflows/store-executions/page.mdx": "2025-02-11T15:56:03.835Z",
|
||||
"app/learn/fundamentals/plugins/create/page.mdx": "2025-02-07T10:26:53.059Z",
|
||||
"app/learn/fundamentals/plugins/page.mdx": "2025-01-22T10:14:10.433Z",
|
||||
"app/learn/customization/reuse-customizations/page.mdx": "2025-01-22T10:01:57.665Z",
|
||||
"app/learn/update/page.mdx": "2025-01-27T08:45:19.030Z",
|
||||
"app/learn/fundamentals/module-links/query-context/page.mdx": "2025-02-03T17:04:24.479Z",
|
||||
"app/learn/fundamentals/module-links/query-context/page.mdx": "2025-02-11T15:56:03.835Z",
|
||||
"app/learn/fundamentals/admin/environment-variables/page.mdx": "2025-02-06T13:29:46.800Z"
|
||||
}
|
||||
+11359
-11359
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user