I have three models
-Company
-User
-Queue
A Company has a OneToOne relationship with a Queue
A User has a many to many relationship with a Queue. So a user can join many queues, and a queue can contain many users.
When a user makes a request for their restaurants, I want a json response like below that shows all the restaurants and whether a user has joined them or not.
[
{
name: 'KFC',
location: 'america',
joined: false
},
{
name: 'McDonalds',
location: 'australia',
joined: true
}
]
To preface, I've got an endpoint for a user to join a queue, and what this does is add the associate a User with a Queue (via an intermediate QueueDetails model).
I am sorta confused on where to add joined. I can't add joined as an attribute to the Company model since it's not an actual part of a Company and more of a User associated thing. So I'm just not sure really how I add joined.