Is it possible to combine to queries in prisma? I ...
# orm-help
f
Is it possible to combine to queries in prisma? I wanted one query to fetch the reviews and other query to check whether or not the user has upvoted that review. almost like creating a virtual field for the response, like a view so to speak review & votes are different tables with keys referencing each other A review can be structured like:
Copy code
{
score: float;
reviewVotes: ReviewVote[]
}
And the review vote:
Copy code
{
reviewId: string;
userId: string;
}
When querying the
reviews
I wanted to be able to return a "virtual field"
hasUserVoted
that would rely on checking whether or not a
reviewVote
with its
userId
exists. I was trying to figure out how to do this in an optimal way