fix: Loading custom modules (#6411)

What:
   fix custom modules loading in medusa project
   pass medusa logger reference to MedusaApp
This commit is contained in:
Carlos R. L. Rodrigues
2024-02-15 12:06:02 -03:00
committed by GitHub
parent 339a946f38
commit 586df9da25
4 changed files with 29 additions and 7 deletions

View File

@@ -18,6 +18,7 @@ import {
simpleHash,
stringifyCircular,
} from "@medusajs/utils"
import { EOL } from "os"
import {
moduleLoader,
registerMedusaLinkModule,
@@ -312,6 +313,14 @@ export class MedusaModule {
keyName
].__joinerConfig()
if (!joinerConfig.primaryKeys) {
logger.warn(
`Primary keys are not defined by the module ${keyName}. Setting default primary key to 'id'${EOL}`
)
joinerConfig.primaryKeys = ["id"]
}
services[keyName].__joinerConfig = joinerConfig
MedusaModule.setJoinerConfig(keyName, joinerConfig)
}