Mutation: Create node with preset values?



Type Output contains titles which user can modify

type Output {
 title: String

but titles are also pre-set through another Type serving as a template:

type OutputTemplate {
 suggestedTitle: "foo"

They are related through parent IDs but as Types are different otherwise they can not be relation based.

How can I create new Output with titles prefetched from OutputTemplate?

mutation {
    data: {
    	titles: { create [fetch ] }

Or should I create empty titles [] and then update?


What stops you from first querying the OutputTemplate node with the template information, and then plugging it into the createOutput mutation accordingly? I feel like I’m missing something here :slight_smile:


I simply cannot find supported syntax to do that in single query, I am trying to avoid roundtrips.


What I didn’t know at the time was that I needed custom resolvers for this… aka create a GraphQL server “yoga style”. I was just using the basic CRUD on Prisma demo server.

A newbie learning step!