d
How can I get the user from a post ID? Been stuck here for a while, any help would be greatly appreciated only way I can seem to do it is pretty hacky
prisma.users({ where: { posts_some: { id: post.id } } })[0]
My use case is even simpler
Copy code
type Shop {
  id: ID! @id
  name: String!
  users: [User!]! @relation(name: "ShopsUsers", link: INLINE)
  shopInvitations: [ShopInvitation!]! @relation(name: "ShopInvitations", link: INLINE)
}

type ShopInvitation {
  id: ID! @id
  shop: Shop! @relation(name: "ShopInvitations")
  user: User @relation(link: INLINE)
}
I want to get a Invitations Shop from an Invitation ID
wow, just figured it out, it was almost too obvious now 🙃
Here for anyone else if they need the fix:
prisma.shopInvitation({ id }).shop()