Skip to content

Commit

Permalink
Merge pull request #2775 from a-alle/fix/overwrite
Browse files Browse the repository at this point in the history
only pass relationship field if overwrite set to false
  • Loading branch information
a-alle authored Jan 24, 2023
2 parents 270d9e4 + 6e172c6 commit 48d4ec5
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 47 deletions.
15 changes: 0 additions & 15 deletions packages/graphql/src/translate/create-connect-and-params.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,6 @@ describe("createConnectAndParams", () => {
}
RETURN count(*) AS _
}
WITH this, this0_node, this0_node_similarMovies0_node
CALL {
WITH this0_node
MATCH (this0_node)-[this0_node_similarMovies_Movie_unique:SIMILAR]->(other:Movie)
WITH count(this0_node_similarMovies_Movie_unique) as c, other
CALL apoc.util.validate(NOT (c = 1), '@neo4j/graphql/RELATIONSHIP-REQUIREDMovie.similarMovies required exactly once for a specific Movie', [0])
RETURN collect(c) AS this0_node_similarMovies_Movie_unique_ignored
}
CALL {
WITH this0_node_similarMovies0_node
MATCH (this0_node_similarMovies0_node)-[this0_node_similarMovies0_node_similarMovies_Movie_unique:SIMILAR]->(other:Movie)
WITH count(this0_node_similarMovies0_node_similarMovies_Movie_unique) as c, other
CALL apoc.util.validate(NOT (c = 1), '@neo4j/graphql/RELATIONSHIP-REQUIREDMovie.similarMovies required exactly once for a specific Movie', [0])
RETURN collect(c) AS this0_node_similarMovies0_node_similarMovies_Movie_unique_ignored
}
WITH this, this0_node, this0_node_similarMovies0_node
RETURN count(*) AS connect_this0_node_similarMovies_Movie
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ function createConnectAndParams({
node: mi[0],
context,
varName: mi[1],
relationshipFieldNotOverwritable: relationField.fieldName,
...(isOverwriteNotAllowed && { relationshipFieldNotOverwritable: relationField.fieldName }),
});
if (relValidationStr) {
relValidationStrs.push(relValidationStr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,6 @@ describe("Interface Relationships - Update connect", () => {
}
RETURN count(*) AS _
}
WITH this, this_connect_actedIn0_node, this_connect_actedIn0_node_actors0_node
CALL {
WITH this_connect_actedIn0_node
MATCH (this_connect_actedIn0_node)<-[this_connect_actedIn0_node_actors_Actor_unique:ACTED_IN]-(other:Actor)
WITH count(this_connect_actedIn0_node_actors_Actor_unique) as c, other
CALL apoc.util.validate(NOT (c = 1), '@neo4j/graphql/RELATIONSHIP-REQUIREDMovie.actors required exactly once for a specific Actor', [0])
RETURN collect(c) AS this_connect_actedIn0_node_actors_Actor_unique_ignored
}
WITH this, this_connect_actedIn0_node, this_connect_actedIn0_node_actors0_node
RETURN count(*) AS connect_this_connect_actedIn0_node_actors_Actor
}
Expand Down Expand Up @@ -254,14 +246,6 @@ describe("Interface Relationships - Update connect", () => {
}
RETURN count(*) AS _
}
WITH this, this_connect_actedIn1_node, this_connect_actedIn1_node_actors0_node
CALL {
WITH this_connect_actedIn1_node
MATCH (this_connect_actedIn1_node)<-[this_connect_actedIn1_node_actors_Actor_unique:ACTED_IN]-(other:Actor)
WITH count(this_connect_actedIn1_node_actors_Actor_unique) as c, other
CALL apoc.util.validate(NOT (c = 1), '@neo4j/graphql/RELATIONSHIP-REQUIREDSeries.actors required exactly once for a specific Actor', [0])
RETURN collect(c) AS this_connect_actedIn1_node_actors_Actor_unique_ignored
}
WITH this, this_connect_actedIn1_node, this_connect_actedIn1_node_actors0_node
RETURN count(*) AS connect_this_connect_actedIn1_node_actors_Actor
}
Expand Down Expand Up @@ -527,14 +511,6 @@ describe("Interface Relationships - Update connect", () => {
}
RETURN count(*) AS _
}
WITH this, this_connect_actedIn1_node, this_connect_actedIn1_node_actors0_node
CALL {
WITH this_connect_actedIn1_node
MATCH (this_connect_actedIn1_node)<-[this_connect_actedIn1_node_actors_Actor_unique:ACTED_IN]-(other:Actor)
WITH count(this_connect_actedIn1_node_actors_Actor_unique) as c, other
CALL apoc.util.validate(NOT (c = 1), '@neo4j/graphql/RELATIONSHIP-REQUIREDSeries.actors required exactly once for a specific Actor', [0])
RETURN collect(c) AS this_connect_actedIn1_node_actors_Actor_unique_ignored
}
WITH this, this_connect_actedIn1_node, this_connect_actedIn1_node_actors0_node
RETURN count(*) AS connect_this_connect_actedIn1_node_actors_Actor
}
Expand Down
7 changes: 0 additions & 7 deletions packages/graphql/tests/tck/operations/connect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,6 @@ describe("Cypher Connect", () => {
RETURN count(*) AS _
}
WITH this0, this0_colors_connect0_node, this0_colors_connect0_node_photos0_node
CALL {
WITH this0_colors_connect0_node
MATCH (this0_colors_connect0_node)<-[this0_colors_connect0_node_photos_Photo_unique:OF_COLOR]-(other:Photo)
WITH count(this0_colors_connect0_node_photos_Photo_unique) as c, other
CALL apoc.util.validate(NOT (c = 1), '@neo4j/graphql/RELATIONSHIP-REQUIREDColor.photos required exactly once for a specific Photo', [0])
RETURN collect(c) AS this0_colors_connect0_node_photos_Photo_unique_ignored
}
CALL {
WITH this0_colors_connect0_node_photos0_node
MATCH (this0_colors_connect0_node_photos0_node)-[this0_colors_connect0_node_photos0_node_color_Color_unique:OF_COLOR]->(:Color)
Expand Down

0 comments on commit 48d4ec5

Please sign in to comment.