Probably an easy-to-answer question inside this th...
# orm-help
c
Probably an easy-to-answer question inside this thread w/r/t getting the author for an invitation - /thread
Question with hopefully dead simple answer: given type
Copy code
type 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:
Copy code
// 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 console
looks like i can either use a raw graphql query, or i need to
db.where(invitation).author()
inside
Invitation.author
resolver