Given 3 models: User
, Book
, Reading
. How to return a list of all books and mark the ones read by a given user.
The result could look something like:
[
{
"id": 1,
"title": "To Kill a Mockingbird",
"read": false
},
{
"id": 2,
"title": "East of Eden",
"read": true
},
{
"id": 3,
"title": "On the Road",
"read": false
}
]
Where read
indicates there is a Reading
object linking this Book
to this User