docs: use tooling convention across docs (#10512)

This commit is contained in:
Shahed Nasser
2024-12-09 19:15:29 +02:00
committed by GitHub
parent 7c76ee24cb
commit 3409953c4f
76 changed files with 283 additions and 265 deletions
@@ -26,7 +26,7 @@ Modules are created in a sub-directory of `src/modules`. So, start by creating t
## 2. Create Data Model
A data model represents a table in the database. You create data models using Medusa's data modeling utility, which is built to improve readability and provide an intuitive developer experience.
A data model represents a table in the database. You create data models using Medusa's Data Model Language (DML). It simplifies defining a table's columns, relations, and indexes with straightforward methods and configurations.
<Note>
@@ -49,7 +49,7 @@ export const Brand = model.define("brand", {
You create a `Brand` data model which has an `id` primary key property, and a `name` text property.
You define the data model using the `define` method of the `model` utility imported from `@medusajs/framework/utils`. It accepts two parameters:
You define the data model using the `define` method of the DML. It accepts two parameters:
1. The first one is the name of the data model's table in the database. Use snake-case names.
2. The second is an object, which is the data model's schema.
@@ -95,7 +95,7 @@ class BrandModuleService extends MedusaService({
export default BrandModuleService
```
The `BrandModuleService` extends a class returned by the `MedusaService` function imported from `@medusajs/framework/utils`. This function generates a class with data-management methods for your module's data models.
The `BrandModuleService` extends a class returned by `MedusaService` from the Modules SDK. This function generates a class with data-management methods for your module's data models.
The `MedusaService` function receives an object of the module's data models as a parameter, and generates methods to manage those data models. So, the `BrandModuleService` now has methods like `createBrands` and `retrieveBrand` to manage the `Brand` data model.
@@ -128,7 +128,7 @@ export default Module(BRAND_MODULE, {
})
```
You use the `Module` function imported from `@medusajs/framework/utils` to create the module's definition. It accepts two parameters:
You use `Module` from the Modules SDK to create the module's definition. It accepts two parameters:
1. The module's name (`brand`). You'll use this name when you use this module in other customizations.
2. An object with a required property `service` indicating the module's main service.
@@ -31,7 +31,7 @@ Learn more about workflows in [this chapter](../../../fundamentals/workflows/pag
## 1. Create createBrandStep
A workflow consists of a series of steps, each step created in a TypeScript or JavaScript file under the `src/workflows` directory. A step is defined using the `createStep` utility function imported from `@medusajs/framework/workflows-sdk`.
A workflow consists of a series of steps, each step created in a TypeScript or JavaScript file under the `src/workflows` directory. A step is defined using `createStep` from the Workflows SDK
The workflow you're creating in this guide has one step to create the brand. So, create the file `src/workflows/create-brand.ts` with the following content:
@@ -120,7 +120,7 @@ So, if an error occurs during the workflow's execution, the brand that was creat
## 2. Create createBrandWorkflow
You can now create the workflow that runs the `createBrandStep`. A workflow is created in a TypeScript or JavaScript file under the `src/workflows` directory. In the file, you use the `createWorkflow` function imported from `@medusajs/framework/workflows-sdk` to create the workflow.
You can now create the workflow that runs the `createBrandStep`. A workflow is created in a TypeScript or JavaScript file under the `src/workflows` directory. In the file, you use `createWorkflow` from the Workflows SDK to create the workflow.
Add the following content in the same `src/workflows/create-brand.ts` file: