not sure if this is a dumb q. It works when I do: ...
# orm-help
j
not sure if this is a dumb q. It works when I do:
Copy code
const pendingRequest = await prisma.connection_request.findFirst({
            where: {
                initiator_id: targetUserProfileId,
                requested_id: authUserProfileId,
            }
        })
But throw error Type ‘{ initiator_id: any; requested_id: number; }’ is not assignable to type ‘connection_requestWhereUniqueInput’. Object literal may only specify known properties, and ‘initiator_id’ does not exist in type ‘connection_requestWhereUniqueInput’. when I do
Copy code
await prisma.connection_request.update({
                where: {
                    initiator_id: targetUserProfileId,
                    requested_id: authUserProfileId,
                },
                data: {
                  confirmed_at: new Date(),
                },
              })
How can I fix it?
1
n
Hey 👋 That’s correct, the where clause in the
update
query should point to a unique record. So combination of `initator_id`and
requested_id
should be unique. Just to confirm, your PrismaClient is in sync with Prisma Schema, right?