captaindaylight
08/02/2019, 4:20 PMtype Referral {
referrer: User! @relation(name: "UserReferrals")
referee: User! @relation(name: "UserReferee")
}
When I try to get the referral by the referee with prisma client, I’m doing this:
const referral = await prisma.referral({ where: { referee: { id: user.id } } });
But gotten the error:
Variable '$where' expected value of type 'ReferralWhereUniqueInput!' but got: {\"where\":{\"referee\":{\"id\":\"cjyu929lr00c7086128xdf46n\"}}}. Reason: 'where' Field 'where' is not defined in the input type 'ReferralWhereUniqueInput'. (line 1, column 8):\nquery ($where: ReferralWhereUniqueInput!)
captaindaylight
08/02/2019, 4:34 PMconst referral = await prisma.referrals().referee({ where: { id: user.id } });
but getting the error Could not find argument where for type User
Hasen
08/02/2019, 10:59 PMReferralWhereUniqueInput
it's because referee isnt a unique field. usually you use id or tag a field as unique to index by. Look at the generated schema docs to see what the input should look like.Krystyna Lemeni Pop
09/26/2019, 6:28 PM