trying to check if a record exists in a table in Postgres using Prisma, but seems like I can only query the id field, but not any other fields like name and location, which gives a compiler error
model schema.prisma
model place {
id Int @id @default(dbgenerated("nextval('place_id_seq'::regclass)"))
name String
location String @unique
}
generated type
export type Place = {
__typename?: 'Place';
name?: Maybe<Scalars['String']>;
location?: Maybe<Scalars['String']>;
};
Query resolver
let findPlace = await prisma.place.findUnique(
{
where: {
name: "abc"
}
}
)
error
Type '{ name: string; }' is not assignable to type 'placeWhereUniqueInput'.
Object literal may only specify known properties, and 'name' does not exist in type 'placeWhereUniqueInput'.ts(2322)
index.d.ts(1361, 5): The expected type comes from property 'where' which is declared here on type '{ select?: placeSelect | null | undefined; include?: placeInclude | null | undefined; rejectOnNotFound?: RejectOnNotFound | undefined; where: placeWhereUniqueInput; }'
what's missing here to make this work?