Darryl
07/04/2018, 1:38 PM// args.ingredients = [ { quantity: 1, ingredient: 'Ingredient 1' }, { quantity: 3, ingredient: 'Ingredient 2' } ]
// args.categories = ["Category 1", "Category 2"]
return context.prisma.mutation.createRecipe(
{
data: {
name,
ingredients: { ... } ← how should this look?
categories: {
connect: [...args.categories]
}
}
},
info
);
I essentially want the written ingredients (on the recipe) to be:
ingredients: [
{
ingredient: { ... } ← this is the connected ingredient from the ingredients table so it'll have all its nested info
quantity: 1 ← this is the quantity specified for that specific ingredient
},
{
ingredient: { ... }
quantity: 3
}
]
As you can see in the mutation, I’m using connect with categories and I get that spreading them will connect to all categories but I don’t understand how to do this with ingredients as I’m not just connecting to the ingredients provided; I’m also wanting to keep the quantity provided.