docs: fixes and changes based on latest updates (#7322)

* docs: changes based on DX changes

* remove fields no longer needed

* remove unnecessary parameters

* fixes to authenticate middleware usage

* add highlight to migrations config

* change configuration to http

* added missing remote link docs

* fix name in sidebar

* added notification module docs + updated file module docs

* add vale exceptions

* fix vale errors

* added docs on custom cli scripts
This commit is contained in:
Shahed Nasser
2024-05-22 13:37:48 +03:00
committed by GitHub
parent ff5d573887
commit 154673f3d8
55 changed files with 1674 additions and 3791 deletions
@@ -40,18 +40,16 @@ The Medusa application resolves these relationships while maintaining isolation
Consider youre creating a data model that adds custom fields associated with a product:
```ts title="src/modules/hello/models/custom-product-data.ts" highlights={[["19"]]}
import { generateEntityId } from "@medusajs/utils"
```ts title="src/modules/hello/models/custom-product-data.ts" highlights={[["17"]]}
import { BaseEntity } from "@medusajs/utils"
import {
BeforeCreate,
Entity,
OnInit,
PrimaryKey,
Property,
} from "@mikro-orm/core"
@Entity()
export class CustomProductData {
export class CustomProductData extends BaseEntity {
@PrimaryKey({ columnType: "text" })
id!: string
@@ -60,16 +58,6 @@ export class CustomProductData {
@Property({ columnType: "text", nullable: true })
product_id?: string
@BeforeCreate()
onCreate() {
this.id = generateEntityId(this.id, "cpd")
}
@OnInit()
OnInit() {
this.id = generateEntityId(this.id, "cpd")
}
}
```
@@ -81,7 +69,6 @@ When you add a new data model, make sure to:
- [Create a migration for it.](../../../basics/data-models/page.mdx#create-a-migration)
- [Add it to the second parameter of the main service's factory function.](../service-factory/page.mdx#abstractModuleServiceFactory-parameters)
- Add it to the [container](../container/page.mdx) and [connection](../connection-loader/page.mdx) loaders.
</Note>
@@ -115,7 +102,6 @@ class HelloModuleService extends ModulesSdkUtils
__joinerConfig(): ModuleJoinerConfig {
return {
serviceName: "helloModuleService",
primaryKeys: ["id"],
alias: [
{
name: ["my_custom"],
@@ -159,12 +145,6 @@ This creates a relationship to the `Product` data model of the Product Module us
optional: false,
description: "The name of your module (as added in `medusa-config.js`)."
},
{
name: "primaryKeys",
type: "`string[]`",
optional: false,
description: "The primary key field names used in your module's data models.",
},
{
name: "alias",
type: "`object[]`",
@@ -240,8 +220,6 @@ const modules = {
helloModuleService: {
// ...
definition: {
key: "helloModuleService",
registrationName: "helloModuleService",
isQueryable: true,
},
},
@@ -251,28 +229,6 @@ const modules = {
Enabling the `isQueryable` property is required to use relationships in a module.
The `definition` propertys value is an object that accepts the following properties, among others:
<TypeList types={[
{
name: "key",
type: "`string`",
optional: false,
description: "The module's key in the `modules` object."
},
{
name: "registrationName",
type: "`string`",
optional: false,
description: "The name that the main service is registered under in the Medusa container. Its recommended to be the same as `key`'s value.",
},
{
name: "isQueryable",
type: "`boolean`",
description: "Whether the module is queryable. This must be enabled to allow a module to have relationships."
}
]} sectionTitle="Adjust Module Configuration" />
---
## Reference Inner Data Models