I am developing semestral work with spring-boot and i am struggling about restController and his endpoints. I have controllers for users, teams, tasks, comments etc.
For example controller for teams has these endpoints:
"/teams"
- returns all teams
"/teams/{idTeam}"
- return specific team by id
etc...
By my opinion these endpoints are fine, but what if i need return tasks for a specific team ? Should be this endpoint look like "/teams/{idTeam}/tasks"
in team controller, or "/tasks/teams/{idTeam}"
in task controller. There is problem that i dont know whether is good practice that controller for teams returns also something else than just team objects... example returns also tasks in team or comments...
Btw. The team entity has array of tasks or comments in itself, but i annotated the arrays with @JsonIgnore because somebody who calls /teams/{idTeam} wants for example just name of the team, not all tasks, comments, users etc of the returned team - so its unnesesary downloading another amount of data.