Closed DevanB closed 5 years ago
The same thing happens to me, I'm using: nexus: 0.11.6, nexus-prisma: 0.3.5, prisma-client-lib: 1.30.0, typescript: 3.4.2, ts-node: 8.0.3
for example in my scheme I have:
type Articulo_detalle {
activo: Boolean!
articulo: Articulo!
cantidad: Int!
id: ID!
producto: Producto!
}
but by looking at the file nexus.js I have:
Articulo_detalle: { // root type
activo: boolean; // Boolean!
cantidad: number; // Int!
id: string; // ID!
}
as well as in the index.ts file of the generated/prisma-client
directory:
export interface Articulo_detalle {
id: ID_Output;
cantidad: Int;
activo: Boolean;
}
The relationship to Producto
is being lost.
Hey 👋,
This is related to the prisma-client rather than nexus-prisma. But yeah, it's expected that roles
aren't fetched by default because it's a relation, and the client only fetches scalar values by default.
prisma.updateUser().roles()
User
type, and if you have a User.roles
resolvers, it will be resolved by doing prisma.user({ id: root.id }).roles()
The only way to fetch relations and scalars right now is by using fragments until the client V2 API lands: https://github.com/prisma/rfcs/pull/2
Hopefully that answers your question. If it doesn't, feel free to re-open 🙌
I'm unsure if this is a nexus-prisma issue, an issue at all, or if I am perhaps misunderstanding something.
I have the following
User
type in mydatamodel.graphl
When I do the following in my server:
I expect to find that
updatedUser
would have aroles
value, however it doesn't. It also seems to be missingorganization
,settings
andsubscription
, which are all relationships.The
User
interface (even after runningprisma generate
several times) is in fact:Am I misunderstanding relationships, or is my generated types missing fields for a reason?
Thanks much! 😄