hello, is it possible to automatically create a ne...
# prisma-whats-new
b
hello, is it possible to automatically create a new node when another node is created, for example when you create a new User node, then automatically create a Role node and assign it to the User? I’ve took a look at Functions but I didn’t find any information about this
n
a nested create mutation should work better in this case
b
thanks for the reply Nilan, but if you do this you kinda of shift the logic from the backend to the frontend
n
ah that's a good point
b
another example would be when a mutation happens to the user, a notification would be created
n
well you can run this logic in a SSS or
TRANSFORM_PAYLOAD
function
b
can I use mutations inside SSS ? I mean can I run queries on graph.cool from inside the functions using fetch?
n
yea, I recommend using
graphql-request
for this
b
cool, thank you very much for the help 🤗
🎉 1
just one more question, if I would want the create User mutation to finish after the Role mutation is done and is assigned to the User I would use Request Pipeline with TRANSFORM_PAYLOAD instead of SSS which is async right?
n
that's correct
🙏 1
b
do you have any idea if the module
graphql-request
can be used with inline code provided by Auth0 or they don’t include this package?
n
do you mean Graphcool Inline Functions?
they do support the package
but we don't yet support const { a } = require('b') syntax
b
got it, thank you 🙂
n
cheers!