I have a schema for GraphQL like this (it's good to mention that I'm using Prisma) :
enum PollResult {
HOME_WIN
AWAY_WIN
DRAW
}
type UserPoll {
id: ID! @unique
user: User!
predict: PollResult!
}
type Poll {
id: ID! @unique
away: Team @relation(name: "AwayTeam")
home: Team @relation(name: "HomeTeam")
group: Group!
country: Country!
sport: Sport!
result: PollResult
state: PollState! @relation(name: "PollState")
users: [User] @relation(name: "Users")
usersPrediction: [UserPoll] @relation(name: "UserPoll")
}
as you see in UserPoll
I have predict
with type of PollResult
and in Poll
I have result
with the type of PollResult
. now I want to query on Poll and find the specific user (with id or email) that has the same value of usersPrediction -> predict
with Poll -> result
.
one query that I try is something like this :
query{
userPolls(where:{user:{id:"someid"}}){
}
}
but here I don't know how to find users with equal predict with polls result.If it's the problem with my schema please let me know.