Is there any reason why the following would return...
# orm-help
k
Is there any reason why the following would return Error: Cannot return null for non-nullable field Event.id ?
Copy code
const res = async ( root, args, ctx ) => await ctx.prisma.updateUser({
        where: {id: promoter.id},
        data: { 
          promotions: { 
            create: [{ ...event }]
          }
        }
      })
return res;
c
I don’t think the response will have
User.promotions.event.id
like you’re expecting. What if you re-query the user and return that, does it work?
k
The id is generated by the model automatically. I assume create would insert it somehow
It would not work if id ins't defined as the error states as this is a non-null field and the above is a mutation attempting to create the said Event object