Hey guys, I see that the PRE_WRITE request pipelin...
# prisma-whats-new
e
Hey guys, I see that the PRE_WRITE request pipeline has been deprecated. I'm looking into setting a private field (createdBy related to the calling user), which I want to be set by the server only. How do I do that?
a
The
TRANSFORM_ARGUMENT
hook (now called operationBefore) still exists. You should use that.
e
By experience, do you know if the current user is accessible from the request data? Or does one need to run a query for that?
a
This was just implemented. The current user (from token) is now available in the context for hooks too!
e
That is: we have to parse the JWT token, right?
a
No. It is available in the function context. Try
console.log(event.context)
in your function to see what's in there. It does not only contain the token, but also
auth
information (nodeId and modelName) from that token. In other words, it is already parsed for you in a secure way.
e
Thanks man! 🙂
😎 1