Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Fix: possible to query interface #291

Merged
merged 1 commit into from
Aug 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 18 additions & 41 deletions src/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export const relationFieldOnNodeType = ({
relType,
nestedVariable,
isInlineFragment,
interfaceLabel,
innerSchemaType,
paramIndex,
fieldArgs,
Expand Down Expand Up @@ -178,23 +177,17 @@ export const relationFieldOnNodeType = ({
relDirection === 'in' || relDirection === 'IN' ? '<' : ''
}-[:${safeLabel([relType])}]-${
relDirection === 'out' || relDirection === 'OUT' ? '>' : ''
}(${safeVariableName}:${safeLabel(
isInlineFragment
? [
interfaceLabel,
...getAdditionalLabels(
resolveInfo.schema.getType(interfaceLabel),
cypherParams
)
]
: [
}(${safeVariableName}${
!isInlineFragment
? `:${safeLabel([
innerSchemaType.name,
...getAdditionalLabels(
resolveInfo.schema.getType(innerSchemaType.name),
cypherParams
)
]
)}${queryParams})${
])}`
: ''
}${queryParams})${
whereClauses.length > 0 ? ` WHERE ${whereClauses.join(' AND ')}` : ''
} | ${nestedVariable} {${
isInlineFragment
Expand Down Expand Up @@ -318,7 +311,6 @@ export const nodeTypeFieldOnRelationType = ({
schemaTypeRelation,
innerSchemaType,
isInlineFragment,
interfaceLabel,
paramIndex,
schemaType,
filterParams,
Expand Down Expand Up @@ -350,7 +342,6 @@ export const nodeTypeFieldOnRelationType = ({
schemaTypeRelation,
innerSchemaType,
isInlineFragment,
interfaceLabel,
paramIndex,
schemaType,
filterParams,
Expand Down Expand Up @@ -397,7 +388,6 @@ const directedNodeTypeFieldOnRelationType = ({
schemaTypeRelation,
innerSchemaType,
isInlineFragment,
interfaceLabel,
filterParams,
temporalArgs,
paramIndex,
Expand Down Expand Up @@ -448,23 +438,17 @@ const directedNodeTypeFieldOnRelationType = ({
relationshipVariableName
)}:${safeLabel(relType)}${queryParams}]-${
isToField ? '>' : ''
}(${safeVar(nestedVariable)}:${safeLabel(
isInlineFragment
? [
interfaceLabel,
...getAdditionalLabels(
resolveInfo.schema.getType(interfaceLabel),
cypherParams
)
]
: [
}(${safeVar(nestedVariable)}${
!isInlineFragment
? `:${safeLabel([
fromTypeName,
...getAdditionalLabels(
resolveInfo.schema.getType(fromTypeName),
cypherParams
)
]
)}) ${
])}`
: ''
}) ${
whereClauses.length > 0
? `WHERE ${whereClauses.join(' AND ')} `
: ''
Expand Down Expand Up @@ -516,23 +500,17 @@ const directedNodeTypeFieldOnRelationType = ({
]
)})${isFromField ? '<' : ''}-[${safeVar(variableName)}]-${
isToField ? '>' : ''
}(${safeVar(nestedVariable)}:${safeLabel(
isInlineFragment
? [
interfaceLabel,
...getAdditionalLabels(
resolveInfo.schema.getType(interfaceLabel),
cypherParams
)
]
: [
}(${safeVar(nestedVariable)}:${
!isInlineFragment
? safeLabel([
innerSchemaType.name,
...getAdditionalLabels(
resolveInfo.schema.getType(innerSchemaType.name),
cypherParams
)
]
)}${queryParams}) | ${nestedVariable} {${
])
: ''
}${queryParams}) | ${nestedVariable} {${
isInlineFragment
? `FRAGMENT_TYPE: labels(${nestedVariable})[0]${
subSelection[0] ? `, ${subSelection[0]}` : ''
Expand Down Expand Up @@ -1394,7 +1372,6 @@ const relationshipDelete = ({
// TODO cleaner semantics: remove use of _ prefixes in root variableNames and variableName
const [subQuery, subParams] = buildCypherSelection({
selections,
variableName,
schemaType,
resolveInfo,
parentSelectionInfo: {
Expand Down