You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I thought I had Nexus JS figured out, but then I started adding foreign keys and relationships into my postgres database. Nothing complex, or so I thought. All of a sudden, all of my resolvers are throwing errors. I am using prisma but I am staying away from their plugin since it is still in development.
Does anyone have an example project for me to look at? Nexus' examples aren't the best IMO.
Thanks!
The Error:
" The expected type comes from property 'resolve' which is declared here on type 'NexusOutputFieldConfig<"Author", "books">' "
My New Database Prisma Schema With Relationship:
model author {
id BigInt u/id u/default(autoincrement())
name String
age Int
gender String
book book[]
}
model book {
id BigInt id default(autoincrement())
title String
genre String
author_id BigInt
author author relation(fields: [author_id], references: [id])
}
You need to define custom resolvers for books field on Author type and for author field on Book type
Inside of these custom resolvers, you will always use prisma findUnique to automatically batch all the queries (You can't use findMany because It's not yet batched by prisma data loader, look here).
So I thought I had Nexus JS figured out, but then I started adding foreign keys and relationships into my postgres database. Nothing complex, or so I thought. All of a sudden, all of my resolvers are throwing errors. I am using prisma but I am staying away from their plugin since it is still in development.
Does anyone have an example project for me to look at? Nexus' examples aren't the best IMO.
Thanks!
The Error:
" The expected type comes from property 'resolve' which is declared here on type 'NexusOutputFieldConfig<"Author", "books">' "
My New Database Prisma Schema With Relationship:
My Nexus Object Types:
The text was updated successfully, but these errors were encountered: