like all the filtering - how do I use that in the ...
# prisma-whats-new
w
like all the filtering - how do I use that in the client like I did with GraphCool?
n
to expose filtering, you would add the
where
parameter:
posts(where: PostWhereInput): [Post]!
w
ah - and I import that from the generated schema?
w
thank you - sorry for all the questions
n
this particular question is truely an FAQ - which is a sign that there is great potential for improving the tooling around this topic πŸ™‚
v
don't apologize, I'm using the answers too - I didn't know you could do
posts(where: PostWhereInput)
n
@veksen, did you know of the example I shared?
v
no I did not
n
aww oki, we should make that more prominent then!
v
-- plus incoming GraphQL tutorial featuring Prisma by wesbos πŸ˜‰
w
So If I want 1:1 Prisma API in the client, I need to add all of these: where orderBy skip after before first last
n
yep!
Do you really want to expose all of them? For example, I rarely use
after
,
before
or
last
w
I guess not - I’m only using skip
n
right
there is also another perspective to this
w
Is there any way to just forward all these passed args in my resolver but still add in auth, or other functionalty before the query?
n
in the additional layer, you can create specific queries for special use cases that rely on the generic Prisma CRUD API under the hood
you can check if the user is authenticated as in this example: https://github.com/graphcool/prisma/blob/master/examples/permissions/src/posts.js#L18
and only then return the
forwardTo
call
w
So you can return forwardTo ?
n
oh sorry, no you can't. if you want to add auth, you need to actually use
ctx.db.query
πŸ™‚
w
ohh 😞
I want this: (I think)
n
thanks so much @wesbos @veksen and everyone else providing feedback for resolver forwarding, I started an open discussion about improving the experience here: https://github.com/graphql-binding/graphql-binding/issues/40 would love to hear your input!
w
thank you πŸ™‚
though the way you coded doesn’t look too bad either - I will try that t oo
n
ah right, wanted to share that here first but then lifted it into a new discussion instead πŸ™‚
w
would this work as well?
Copy code
items(parent, args, ctx, info) {
    // check auth
    return ctx.db.query.items({ ...args }, info);
  },
looks like it does..
h
@wesbos the thing that answered all your questions that i strugged with as well was their airbnb example : https://github.com/graphcool/graphql-server-example It's really well done however its not in their
examples
folder in the prisma repo
πŸ‘ 3
That's how i understood their # import magic etc
n
yes, that would work @wesbos