fix(link-modules): fix warn on readonly links (#7403)
This commit is contained in:
committed by
GitHub
parent
5e0f98f578
commit
e760dbc953
@@ -12,7 +12,8 @@ export function generateGraphQLSchema(
|
||||
let fieldNames!: string[]
|
||||
let entityName!: string
|
||||
|
||||
if (!joinerConfig.isReadOnlyLink) {
|
||||
const isReadOnlyLink = joinerConfig.isReadOnlyLink
|
||||
if (!isReadOnlyLink) {
|
||||
fieldNames = primary.foreignKey.split(",").concat(foreign.foreignKey)
|
||||
|
||||
entityName = toPascalCase(
|
||||
@@ -31,7 +32,11 @@ export function generateGraphQLSchema(
|
||||
|
||||
for (const extend of joinerConfig.extends ?? []) {
|
||||
const extendedModule = MedusaModule.getModuleInstance(extend.serviceName)
|
||||
if (!extendedModule && !extend.relationship.isInternalService) {
|
||||
if (
|
||||
!isReadOnlyLink &&
|
||||
!extendedModule &&
|
||||
!extend.relationship.isInternalService
|
||||
) {
|
||||
throw new Error(
|
||||
`Module ${extend.serviceName} not found. Please verify that the module is configured and installed, also the module must be loaded before the link modules.`
|
||||
)
|
||||
@@ -69,7 +74,7 @@ export function generateGraphQLSchema(
|
||||
`
|
||||
}
|
||||
|
||||
if (joinerConfig.isReadOnlyLink) {
|
||||
if (isReadOnlyLink) {
|
||||
return typeDef
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user