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

Support many-to-many in a simple way? #119

Open
crubier opened this issue Feb 1, 2020 · 3 comments
Open

Support many-to-many in a simple way? #119

crubier opened this issue Feb 1, 2020 · 3 comments

Comments

@crubier
Copy link

crubier commented Feb 1, 2020

Right now this plugin does not support many-to-many relations simply. You have to go through the relation table in GraphQL query, which is not ideal, or at least not consistent with the behaviour of Prisma that we are migrating away from.

The many-to-many plugin ( https://github.com/graphile-contrib/pg-many-to-many ) support this, but only in GraphQL selection sets, not in query arguments.

Is there any way or plan to support the simplification of many-to-many filters in this plugin?

@crubier
Copy link
Author

crubier commented Jul 2, 2020

@mattbretl my company would be willing to pay to get this feature done (as open sourced of course👍), is this a possibility?

@crubier
Copy link
Author

crubier commented Jul 3, 2020

I have a data model that definitely involve many-to-many relations. We used to use Prisma and many-to-many relations used to be fairly straightforward, just like one-to-many or one-to-one relations basically. Now with Graphile we have to add one "layer" of nesting in query fields arguments every time we have many-to-many relations, while one-to-many or one-to-one relations are fine on the other hand.

Basically in Prisma, 1-1, 1-m, and m-m were treated the same way. In Graphile, 1-1 an 1-m are treated that same way, but m-m are treated in their own different way (with 1 level of nesting in query parameters). That additional level of nesting is not present on selection sets, thanks to the many-to-many plugin. So it strikes me as odd that the plugin solves half the problem (selection sets) while leaving the other half open (mutations and query parameters)

The end result in our API is something some internally already start to call "nesting hell":

image (32)

This is the API we used to have and that we wished we could get with a plugin:

Screenshot 2020-07-03 at 14 54 24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants