I'm facing an issue with neo4j-graphql-js npm module. I want to manipulate data inside GraphQL resolvers (like an OGM with models: findAll, findById, update, etc.) to add more business logic. But neo4j-graphql-js doesn't provide a way to do it, just maps GraphQL functions to one cypher query.
My typical use case is the following:
I have Article and Tag nodes. An Article can be tagged by multiple Tags. So, when I create an Article, I want to create the Article but Tags and relations too. I can do it with a single cypher but I think isn't the proper way when the app will growth.
To solve this issue, I found two ways:
- The one is to use an OGM (neo4j-node-ogm) instead of (or in addition to) neo4j-graphql. The cons of this method is that we have to redefine models in addition to existing graphql schema and be careful about changes between both.
- The other solution would be to create a new graphQL API over the existing graphQL and use blueprint functions autogenerated by neo4j-graphql-js on the second one to manipulate data at the top level.
What is the best way ? Or is there another way to solve it ?