Chris Zempel
10/31/2019, 12:52 PMChris Zempel
10/31/2019, 12:52 PMtype Invitation {
id: ID! @id
createdAt: DateTime! @createdAt
updatedAt: DateTime @updatedAt
author: User! @relation(link: INLINE)
email: String! @unique
permissions: [Permission]! @scalarList(strategy: RELATION)
status: InvitationStatus!
token: String!
tokenExpiry: Float!
}
how do I use the generated prisma client to also return author via:
// query
query invitations($first:Int, $skip:Int) {
invitations(first:$first, skip:$skip, orderBy: createdAt_DESC) {
createdAt
author {
name
email
}
email
permissions
status
}
}
// ctx.db = prisma client
const invitations = await ctx.db.invitations({ first, skip, orderBy });
The query otherwise works, and I've confirmed the id for the user is stored in "author" via the admin consoleChris Zempel
11/01/2019, 12:38 PMdb.where(invitation).author() inside Invitation.author resolver