Skip to content

Commit

Permalink
docs: revise extend models (features) (#10429)
Browse files Browse the repository at this point in the history
  • Loading branch information
shahednasser authored Dec 4, 2024
1 parent ff46637 commit 51b8b39
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 61 deletions.
2 changes: 1 addition & 1 deletion www/apps/api-reference/markdown/admin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ If you click on the workflow, you'll view a reference of that workflow, includin

This is useful if you want to extend an API route and pass additional data or perform custom actions.

Refer to [this guide](https://docs.medusajs.com/learn/customization/extend-models/extend-create-product) to find an example of extending an API route.
Refer to [this guide](https://docs.medusajs.com/learn/customization/extend-features/extend-create-product) to find an example of extending an API route.

<Feedback
event="survey_api-ref"
Expand Down
2 changes: 1 addition & 1 deletion www/apps/api-reference/markdown/store.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ If you click on the workflow, you'll view a reference of that workflow, includin

This is useful if you want to extend an API route and pass additional data or perform custom actions.

Refer to [this guide](https://docs.medusajs.com/learn/customization/extend-models/extend-create-product) to find an example of extending an API route.
Refer to [this guide](https://docs.medusajs.com/learn/customization/extend-features/extend-create-product) to find an example of extending an API route.

<Feedback
event="survey_api-ref"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This chapter covers how to show the brand of a product in the Medusa Admin using
items={[
{
text: "Retrieve Brand of Product API Route",
link: "/learn/customization/extend-models/query-linked-records"
link: "/learn/customization/extend-features/query-linked-records"
}
]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ It's useful when you want to pass custom data, such as the brand ID, then perfor
},
{
text: "Defined link between the Brand and Product data models.",
link: "/learn/customization/extend-models/define-link"
link: "/learn/customization/extend-features/define-link"
}
]}
/>
Expand Down
25 changes: 25 additions & 0 deletions www/apps/book/app/learn/customization/extend-features/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export const metadata = {
title: `${pageNumber} Extend Core Commerce Features`,
}

# {metadata.title}

In the upcoming chapters, you'll learn about the concepts and tools to extend Medusa's core commerce features.

In other commerce platforms, you extend core features and models through hacky workarounds that can introduce unexpected issues and side effects across the platform. It also makes your application difficult to maintain and upgrade in the long run.

Medusa's framework and orchestration tools mitigate these issues while supporting all your customization needs:

- [Module Links](../../advanced-development/module-links/page.mdx): Link data models of different modules without building direct dependencies, ensuring that the Medusa application integrates your modules without side effects.
- [Workflow Hooks](../../advanced-development/workflows/workflow-hooks/page.mdx): inject custom functionalities into a workflow at predefined points, called hooks. This allows you to perform custom actions as a part of a core workflow without hacky workarounds.
- [Additional Data in API Routes](../../advanced-development/api-routes/additional-data/page.mdx): Configure core API routes to accept request parameters relevant to your customizations. These parameters are passed to the underlying workflow's hooks, where you can manage your custom data as part of an existing flow.

---

## Next Chapters: Link Brands to Products Example

The next chapters explain how to use the tools mentioned above with step-by-step guides. You'll continue with the [brands example from the previous chapters](../custom-features/page.mdx) to:

- Link brands from the custom [Brand Module](../custom-features/module/page.mdx) to products from Medusa's [Product Module](!resources!/commerce-modules/product).
- Extend the core product-creation workflow and the API route that uses it to allow setting the brand of a newly created product.
- Retrieve a product's associated brand's details.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Query is a utility that retrieves data across modules and their links. It’s re
},
{
text: "Defined link between the Brand and Product data models.",
link: "/learn/customization/extend-models/define-link"
link: "/learn/customization/extend-features/define-link"
}
]}
/>
Expand Down
40 changes: 0 additions & 40 deletions www/apps/book/app/learn/customization/extend-models/page.mdx

This file was deleted.

10 changes: 5 additions & 5 deletions www/apps/book/generated/edit-dates.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ export const generatedEditDates = {
"app/learn/customization/custom-features/api-route/page.mdx": "2024-11-28T13:12:10.521Z",
"app/learn/customization/custom-features/module/page.mdx": "2024-11-28T09:25:29.098Z",
"app/learn/customization/custom-features/workflow/page.mdx": "2024-11-28T10:47:28.084Z",
"app/learn/customization/extend-models/create-links/page.mdx": "2024-09-30T08:43:53.133Z",
"app/learn/customization/extend-models/extend-create-product/page.mdx": "2024-09-30T08:43:53.134Z",
"app/learn/customization/extend-features/create-links/page.mdx": "2024-09-30T08:43:53.133Z",
"app/learn/customization/extend-features/extend-create-product/page.mdx": "2024-09-30T08:43:53.134Z",
"app/learn/customization/custom-features/page.mdx": "2024-11-28T08:21:55.207Z",
"app/learn/customization/customize-admin/page.mdx": "2024-09-12T12:25:29.853Z",
"app/learn/customization/customize-admin/route/page.mdx": "2024-10-07T12:43:11.335Z",
"app/learn/customization/customize-admin/widget/page.mdx": "2024-10-07T12:44:24.538Z",
"app/learn/customization/extend-models/define-link/page.mdx": "2024-09-30T08:43:53.134Z",
"app/learn/customization/extend-models/page.mdx": "2024-09-12T12:38:57.394Z",
"app/learn/customization/extend-models/query-linked-records/page.mdx": "2024-09-30T08:43:53.134Z",
"app/learn/customization/extend-features/define-link/page.mdx": "2024-09-30T08:43:53.134Z",
"app/learn/customization/extend-features/page.mdx": "2024-09-12T12:38:57.394Z",
"app/learn/customization/extend-features/query-linked-records/page.mdx": "2024-09-30T08:43:53.134Z",
"app/learn/customization/integrate-systems/handle-event/page.mdx": "2024-09-30T08:43:53.135Z",
"app/learn/customization/integrate-systems/page.mdx": "2024-09-12T12:33:29.827Z",
"app/learn/customization/integrate-systems/schedule-task/page.mdx": "2024-09-30T08:43:53.135Z",
Expand Down
13 changes: 9 additions & 4 deletions www/apps/book/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,23 @@ const nextConfig = {
{
source: "/recipes/:path*",
destination: "/resources/recipes",
permanent: true
permanent: true,
},
{
source: "/plugins/:path*",
destination: "/v1/plugins/:path*",
permanent: true
permanent: true,
},
{
source: "/medusa-react/:path*",
destination: "/v1/medusa-react/:path*",
permanent: true
}
permanent: true,
},
{
source: "/learn/customization/extend-models/:path*",
destination: "/learn/customization/extend-features/:path*",
permanent: true,
},
]
},
}
Expand Down
12 changes: 6 additions & 6 deletions www/apps/book/sidebar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -115,28 +115,28 @@ export const sidebar = numberSidebarItems(
},
{
type: "link",
title: "Extend Models",
path: "/learn/customization/extend-models",
title: "Extend Features",
path: "/learn/customization/extend-features",
children: [
{
type: "link",
title: "Define Link",
path: "/learn/customization/extend-models/define-link",
path: "/learn/customization/extend-features/define-link",
},
{
type: "link",
title: "Create Links Between Records",
path: "/learn/customization/extend-models/create-links",
path: "/learn/customization/extend-features/create-links",
},
{
type: "link",
title: "Extend Route",
path: "/learn/customization/extend-models/extend-create-product",
path: "/learn/customization/extend-features/extend-create-product",
},
{
type: "link",
title: "Query Linked Records",
path: "/learn/customization/extend-models/query-linked-records",
path: "/learn/customization/extend-features/query-linked-records",
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion www/apps/resources/app/examples/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ In this example, you'll pass additional data to the Create Product API route, th

<Note>

Find this example in details in [this documentation](!docs!/learn/customization/extend-models/extend-create-product).
Find this example in details in [this documentation](!docs!/learn/customization/extend-features/extend-create-product).

</Note>

Expand Down

0 comments on commit 51b8b39

Please sign in to comment.