0

Given Prisma schema:

model companiesOnUsers {
  company   company      @relation(fields: [companyId], references: [id])
  companyId Int
  user      user         @relation(fields: [userId], references: [id])
  userId    Int
  role      companyRoles @relation(fields: [roleId], references: [id])
  roleId    Int
  createdAt DateTime     @default(now())
  updatedAt DateTime     @updatedAt

  @@id([companyId, userId])
}

The question is, how do you generate GraphQL out of it? Writing this twice is not an option.

Daniel
  • 839
  • 10
  • 20
  • Did you have a look at Pothos Prisma Plugin? This should help you in creating GraphQL models based on your schema file https://github.com/hayes/pothos/tree/main/packages/plugin-prisma – Nurul Sundarani Dec 22 '22 at 10:18

1 Answers1

0

I think I found an answer: TypeGraphQL Prisma package

Works with Prisma 4.8.0

Daniel
  • 839
  • 10
  • 20