Comments (9)
same problem
from prisma-binding.
@kbrandwijk If I do this I get an error saying I didn't make a subselection for the createUser
mutation (Field 'createUser' of type 'User' must have a sub selection
). I think the info argument from my signupCompany
mutation is incompatible with Prisma's createUser
.
from prisma-binding.
A tool that could allow us to easily take information from the info
argument of the resolver would be useful on these cases I think. I thought about something like this:
async function myResolver(parent, args, ctx, info) {
const userInfo = pluck('user', info);
const user = await ctx.db.mutation.createUser({ ... }, userInfo);
return { user };
}
I tried searching for a tool like pluck
in my example, but failed to find anything. Then I also started studying the info
structure to do it myself, but was overwhelmed by its complexity and couldn't put more time into it.
from prisma-binding.
I think just passing through the info argument should work, but I haven't looked at your example in detail.
from prisma-binding.
We'll look into this! 👀
from prisma-binding.
That's an interesting idea @gcangussu. Could you open a new issue for this and elaborate a bit further with a few examples?
from prisma-binding.
same
from prisma-binding.
@schickling I've done this on #118. But with only one example, I will try to add other examples later.
from prisma-binding.
Hey
guessing the mutations wouldn't make much sense because prisma-binding
, even though it serves as a complement to Prisma, isn't tied directly to it in its core implementation.
As @kbrandwijk mentioned, you should find a way to pass down the info
parameter. A solution to your problem is implementing AuthPayload
which receives the correctly modified info
parameter. Check the code I posted below.
const AuthPayload = {
async user({ user: { id }}, args, ctx: Context, info) {
return ctx.db.query.user({ where: { id }}, info)
}
}
Due to inactivity of this issue, I'll close it but feel free to reopen it if you think we should further discuss its content.
from prisma-binding.
Related Issues (20)
- how to submit many transactions
- Connect Prisma Bindings to mock server
- Calling a query from Yoga to Prisma does nothing. HOT 5
- Case Sensitive Query Adjustments. HOT 2
- Calling multiple prisma requests returns same error to all the request if any one of them gives error.
- forwardTo() without having to specify resolver keys
- Cannot set property 'fragmentReplacements' of undefined HOT 1
- forwardTo with type rename
- how to get the count of records
- Howto define subscription endpoint
- Sub-selecting custom fields HOT 2
- Subscription Implementation with Prisma Binding
- Improve Code Readability
- error when trying to call aggregate function HOT 1
- Aliases still not works correctly
- How to filter `Where null` HOT 1
- Prisma() not recognized as a constructor HOT 1
- Import error on IResolvers from graphql-tools
- The automated release is failing 🚨
- Version of this for graphql-code-generator ?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prisma-binding.