I am trying to run a query on a simple prisma entity User.
Model:
model User {
id Int @id @default(autoincrement())
name String?
email String @unique
role Role @default(USER)
}
Entity User includes a prop called Role with a type of enum.
Role enum:
enum Role {
USER
ADMIN
}
Except doing it in raw SQL query, how is this possible to do with Prisma where API:
const whereNameIs = await prisma.user.findMany({
name: 'Rich',
role: ?
})
Any custom enum type written in TS or conversion won't match. Is there any workaround in typescript for this?