isemaj
10/30/2019, 3:50 AM@relation?
Example
type Board {
id: ID! @id
boardTitle: String!
boardDescription: String!
createdBy: User! @relation(name: "UsersBoard" link: INLINE)
}
type User {
id: ID! @id
name: String!
boards: [Board!]! @relation(name: "UsersBoard")
}
Running prisma.boards() will return boards with boardTitle and boardDescription but not including the createdBy field.
In order to include it I have to use fragment:
const fragment = `
fragment BoardWithCreator on Board {
id
boardId
boardTitle
boardDescription
createdBy {
name
}
}
`;
prisma.boards().$fragment(fragment);
And that will return boards with createdBy field.
And is there any other way to include createdBy field without using fragment?