Open marktani opened 6 years ago
Comment by marktani Saturday Oct 07, 2017 at 15:34 GMT
Model
I think querying nodes should behave the same as all other queries in terms of the permission system.
Is it possible to include/exclude query arguments for [Post!]!
and Post
/Post!
fields?
Comment by kbrandwijk Saturday Oct 07, 2017 at 17:29 GMT
A huge :+1: on the proposal for how to return an model Type. I've been thinking about this, because returning the actual object is not feasible because of relations that are not part of the returned data. The solution with the id is a wonderful solution to it!
Comment by kbrandwijk Saturday Oct 07, 2017 at 17:33 GMT
@marktani Interesting addition on the permissions. However, that would require the user token, not the PAT, to execute queries inside resolver functions. So you would need both tokens as part of the context.
Comment by marktani Saturday Oct 07, 2017 at 17:38 GMT
no, checking permissions would be handled by the framework that has access to the node token.
Comment by kbrandwijk Saturday Oct 07, 2017 at 17:48 GMT
@marktani Can you explain how that would work. I'm especially concerned in what I can do as a developer to influence that behavior. I have the 'freedom' to execute queries using the root token (or whatever it's called now). Then, if I return an Id from such a query, the users' permissions would suddenly be applied automatically? I definitely think that's not something I want.
Comment by marktani Saturday Oct 07, 2017 at 18:02 GMT
That's how I imagine it to work, but I see that this is not necessarily the desired behavior in all cases.
On the other hand, exposing all data connected to nodes returned in a resolver is probably also not desired.
Comment by kbrandwijk Saturday Oct 07, 2017 at 18:05 GMT
So maybe 'just' returning the Id of a Node is not enough for the 'internals' to know how to deal with this. Maybe we need a different syntax, an object like { nodeId: "....", token: "..." }
to indicate which id we want to return, and how to retrieve it. Or { nodeId: "....", applyPermissions: true | false }
. Or...?
@marktani - Any ETA? :)
Seconding @jhalborg 's question, any ETA?
If you're wondering how to prioritise parts of this ticket, I think being able to return an existing @model type should be the first step.
If you're wondering how to prioritise parts of this ticket, I think being able to return an existing @model type should be the first step.
Seconded. We're sorely in need for support of this functionality.
Considering the age of this issue, I guess the ETA is indefinite at this point @marktani :(
Issue by sorenbs Saturday Oct 07, 2017 at 15:16 GMT Originally opened as https://github.com/graphcool/prisma/issues/743
Resolvers return a payload that can be constructed in many different ways:
Scalar
https://github.com/graphcool/graphcool/issues/729
proposal/accepted
https://github.com/graphcool/graphcool/issues/742Return one of the supported scalar types:
Transient
https://github.com/graphcool/graphcool/issues/543
proposal/needs-spec
Return a type that is not stored in the Graphcool database:
Model
Return a type that is stored in the Graphcool database:
Nested Transient
Transient types can be arbitrarily nested:
Combined Transient and Model
Model types can be returned from Transient type: