Skip to content

Commit

Permalink
Fix: possible to query interface
Browse files Browse the repository at this point in the history
Fixed merge commit that did not correctly merge two changes - using
multiple labels on nodes and allowing multiple inline fragments.

Issue number: neo4j-graphql#289
  • Loading branch information
michal-trnka committed Aug 16, 2019
1 parent 08dc731 commit 95f4834
Showing 1 changed file with 18 additions and 41 deletions.
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

0 comments on commit 95f4834

Please sign in to comment.