fix(index): detect enum field (#14298)
## Summary **What** — What changes are introduced in this PR? Fixes Enum fields detection on Index module
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/index": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(index): detect enum fields
|
||||||
@@ -845,7 +845,9 @@ function processEntity(
|
|||||||
]
|
]
|
||||||
intermediateEntityObjectRepresentationRef.moduleConfig =
|
intermediateEntityObjectRepresentationRef.moduleConfig =
|
||||||
intermediateEntityModule
|
intermediateEntityModule
|
||||||
if (!intermediateEntityObjectRepresentationRef.fields.includes("id")) {
|
if (
|
||||||
|
!intermediateEntityObjectRepresentationRef.fields.includes("id")
|
||||||
|
) {
|
||||||
intermediateEntityObjectRepresentationRef.fields.push("id")
|
intermediateEntityObjectRepresentationRef.fields.push("id")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1185,7 +1187,10 @@ function buildSchemaFromFilterableLinks(
|
|||||||
const fieldType = fieldRef.type.toString()
|
const fieldType = fieldRef.type.toString()
|
||||||
const isArray = fieldType.startsWith("[")
|
const isArray = fieldType.startsWith("[")
|
||||||
let currentType = fieldType.replace(/\[|\]|\!/g, "")
|
let currentType = fieldType.replace(/\[|\]|\!/g, "")
|
||||||
const isEnum = currentType.endsWith("Enum")
|
const isEnum =
|
||||||
|
fieldRef.type?.ofType?.astNode?.kind ===
|
||||||
|
GraphQLUtils.Kind.ENUM_TYPE_DEFINITION
|
||||||
|
|
||||||
if (isEnum) {
|
if (isEnum) {
|
||||||
currentType = "String"
|
currentType = "String"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user