Skip to content

Commit 720a5ee

Browse files
authored
Add simple relationship filters for interface and union relationships (#4829)
1 parent efdadcf commit 720a5ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3034
-42
lines changed

.changeset/grumpy-lamps-pump.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@neo4j/graphql": minor
3+
---
4+
5+
Add simple relationship filter for relationships to interface types

packages/graphql/src/schema/generation/where-input.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,6 @@ export function withSourceWhereInputType({
163163
const relationshipTarget = relationshipAdapter.target;
164164
const relationshipSource = relationshipAdapter.source;
165165
const whereInput = composer.getITC(relationshipSource.operations.whereInputTypeName);
166-
// TODO: relationship simple filters were not supported on Interface target, only connection filters
167-
// when implementing translation, simply remove this if-case
168-
if (relationshipTarget instanceof InterfaceEntityAdapter) {
169-
const connectionFields = augmentWhereInputTypeWithConnectionFields(relationshipAdapter, deprecatedDirectives);
170-
whereInput.addFields(connectionFields);
171-
return whereInput;
172-
}
173166
const fields = augmentWhereInputTypeWithRelationshipFields(relationshipAdapter, deprecatedDirectives);
174167
whereInput.addFields(fields);
175168

packages/graphql/src/translate/queryAST/factory/FilterFactory.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -221,24 +221,6 @@ export class FilterFactory {
221221
// this is because if isNull is true we want to wrap the Exist subclause in a NOT, but if isNull is true and isNot is true they negate each other
222222
const isNot = isNull ? !filterOps.isNot : filterOps.isNot;
223223

224-
if (isInterfaceEntity(relationship.target)) {
225-
const relationshipFilter = this.createRelationshipFilterTreeNode({
226-
relationship,
227-
target: relationship.target,
228-
isNot,
229-
operator: filterOps.operator || "SOME",
230-
});
231-
232-
if (!isNull) {
233-
if (isInterfaceEntity(relationship.target)) {
234-
throw new Error("Interface filter to be implemented");
235-
}
236-
const targetNodeFilters = this.createNodeFilters(relationship.target, where);
237-
relationshipFilter.addTargetNodeFilter(...targetNodeFilters);
238-
}
239-
240-
return [relationshipFilter];
241-
}
242224
const filteredEntities = getConcreteEntities(relationship.target, where);
243225
const relationshipFilters: RelationshipFilter[] = [];
244226
for (const concreteEntity of filteredEntities) {

0 commit comments

Comments
 (0)