Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move interface projection to cypher builder #2030

Merged

Conversation

angrykoala
Copy link
Member

@angrykoala angrykoala commented Sep 2, 2022

Description

This PR refactors interface projections so they are generated with CypherBuilder. This allows to remove duplicate code regarding filtering

@changeset-bot
Copy link

changeset-bot bot commented Sep 2, 2022

⚠️ No Changeset found

Latest commit: 7f55d66

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@neo4j-team-graphql
Copy link
Collaborator

neo4j-team-graphql commented Sep 2, 2022

Thanks for the UI updates.

The UI has now been torn down - reopening this PR will republish it.

@angrykoala angrykoala marked this pull request as ready for review September 2, 2022 14:52
Copy link
Contributor

@tbwiss tbwiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nothing really to add apart from maybe double-checking if the comments on your new code are (still) needed.

@angrykoala angrykoala force-pushed the move-interface-projection-to-cypher-builder branch from c820d7a to 7e0baa2 Compare September 5, 2022 09:42
@angrykoala angrykoala force-pushed the move-interface-projection-to-cypher-builder branch from 7e0baa2 to 42f3075 Compare September 5, 2022 09:54
Copy link
Contributor

@tbwiss tbwiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@darrellwarde darrellwarde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good, some nice improvements on top of the refactor! It might even address the bug I have fixed in my PR, time will tell when I merge!

MATCH (this)-[:ACTED_IN]->(this_Series:Series)
CALL apoc.util.validate(NOT ((this_Series.episodes IS NOT NULL AND this_Series.episodes = $this_Seriesauth_param0)), \\"@neo4j/graphql/FORBIDDEN\\", [0])
MATCH (this)-[thisthis1:ACTED_IN]->(this_Series:\`Series\`)
WHERE apoc.util.validatePredicate(NOT ((this_Series.episodes IS NOT NULL AND this_Series.episodes = $thisparam0)), \\"@neo4j/graphql/FORBIDDEN\\", [0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is super slick, I love it! 👏


function createInterfaceProjectionAndParams({
export default function createInterfaceProjectionAndParams({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for the default export? It feels to me like we're moving away from this direction in most cases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, it is just because that was what were being exported, and to reduce the scope of the refactor I kept it as such

MATCH (this)-[:HAS_CONTENT]->(this_Post:Post)
WHERE (exists((this_Post)<-[:HAS_CONTENT]-(:\`User\`)) AND all(auth_this0 IN [(this_Post)<-[:HAS_CONTENT]-(auth_this0:\`User\`) | auth_this0] WHERE (auth_this0.id IS NOT NULL AND auth_this0.id = $this_Postauth_param0)))
MATCH (this)-[thisthis1:HAS_CONTENT]->(this_Post:\`Post\`)
WHERE (exists((this_Post:\`Post\`)<-[:HAS_CONTENT]-(:\`User\`)) AND all(thisthis2 IN [(this_Post:\`Post\`)<-[:HAS_CONTENT]-(thisthis2:\`User\`) | thisthis2] WHERE (thisthis2.id IS NOT NULL AND thisthis2.id = $thisparam0)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we're currently suffering from this bug with EXISTS, but I feel like we should shortly (or maybe even already) be in a position where we can move to using EXISTS clauses across the board! 🥳

@angrykoala angrykoala merged commit 5984d77 into neo4j:dev Sep 6, 2022
@angrykoala angrykoala deleted the move-interface-projection-to-cypher-builder branch September 6, 2022 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants