arc
PPrisma
•Created by arc on 8/1/2024 in #help-and-questions
How to add a custom field on query result?
I have an implicit many-to-many relation: User and Post. A user could like many posts, and a post could be liked by many users.
Here is the schema:
Now I want to get the post lists to render. For every post, there will be a heart showing if it's already liked by current user. How could I get a structure with type
Post & { isLiked: boolean }
? It would be perfect if it could be done in one query.2 replies