4 ms·
I spent 4 days trying to implement this in a side project. My biggest complaint was that it was too automatic. It created resources that I didn’t want. As an e
by dustinmoorenet 10y ago
I spent 4 days trying to implement this in a side project. My biggest complaint was that it was too automatic. It created resources that I didn’t want.
As an example, I had a table (A) that was linked to a user table (B) through a many-to-many table (C). I needed the shape of table A available as a type so that I could get all associated rows of A for users (B), but not let anyone see all of table A. I had no way of telling PostGraphQL to hide table A but allow the shape of A to be public.
I hope they expand it's configurability more in the future.
- ruslan_talpa 10y agothey don't need to expand anything for you to have this functionality. You don't expose the schema where your tables live, you create a different schema (api) where mirror views for those tables live. The second step is to add conditions on those views in such a way that when conceptually your client does "select * from A/B" he sees only the rows he is supposed to see and not all the rows.
- ruslan_talpa 10y agoAnother way to say this is: PostGraphQL exposes as an api whatever it sees in the specific database schema. It's your job to show it only the stuff it's supposed to expose and there is a lot of flexibility in the database available to help you do just that (role system, views, stored procedures, RLS, constraints).