Hey guys, quick question. I have a form, user subm...
# prisma-whats-new
a
Hey guys, quick question. I have a form, user submits an email of someone else. Each user has a relation with another user, 1 to 1. How do I make it so that the email of someone else, also creates the relation with userIDs? The user has no way of knowing the id from the email(but I could make it so) just wondering if I can do this within a function, thanks!
a
You can do this with a Schema Extension, you can create a mutation that takes the email address as argument. In the function, you can lookup the user id and link it to the user calling the mutation
You can also do this in a Request Pipeline hook if the email address is part of an existing Type.
a
Thanks @agartha do you have any docs you personally recommend ro get started with this? 🙂
a
You can find some guidelines on how to communicate with your endpoint from a RP hook here: https://www.graph.cool/docs/reference/functions/request-pipeline/communicate-with-external-apis-phe1gei6io/
For in a Schema Extension, you can use
graphcool-lib
which is more convenient. More info here: https://www.graph.cool/docs/reference/functions/graphcool-lib-kaegh4oomu/
a
Thank you @agartha, after playing around and it not working, I realize I need the beta invite 😄
a
Only when using Schema Extensions. You can contact @nilan to 'get in'.