I have:
- A User entity.
- A Poll entity.
Relationship: User creates polls.
Use-case:
When an arbitrarily user is clicked his/her profile is loaded and shown.
The profile includes a list of polls created by the clicked user.
Which of the following api calls is the proper usage of such a use-case?
- website.com/api/users/{username}/polls
- website.com/api/polls?username=xxx
Between The Lines:
I currently have a UserController & a PollController.
PollController has:
- getPolls()
- createPoll()
- getPollById()
UserController has functions related to the user, handles api calls starting with /api/users/...
I am trying to figure out which controller should handle the request to get polls by a user.