jeudi 16 février 2017

Entity Relations in Services

I have such model relations: User, Task, each user can create his own tasks and can see All tasks. So obviously I'll have TaskService with methods getAllTasks(), getSortedTasks(String value), etc. I'm confused where should I have createTask(Task task), updateTask(lond id, Task task) methods - in TaskService or in UserService, because I'm told I should have REST API looks like:

rather

post users/{id}/tasks

than

post /tasks

because "a task belongs to a particular user". So I can't choose between separate services,api and common services,api whre User is relations owner.

Aucun commentaire:

Enregistrer un commentaire