An example todos app with DDD approach
- http://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
- https://hackernoon.com/making-a-case-for-domain-modeling-17cf47030732
- https://medium.com/swlh/creating-coding-excellence-with-domain-driven-design-88f73d2232c3
- https://www.javacodegeeks.com/2016/10/architectural-layers-modeling-domain-logic.html
- https://www.alibabacloud.com/blog/handling-complex-business-scenarios-with-domain-modeling-%E2%80%93-part-1_593863?spm=a2c65.11461447.0.0.acc85f82jfZ0Us
- User will be logged in by providing a username (no need password, no need to register)
- User could manage one ore more todo task items
- Each task's state could be as follow: new -> doing -> done
- To stay focused, user could only have 3 doing tasks at a time. But if he has finished at least 3 tasks in his lifetime usage, he could have up to 5 concurrent doing tasks
- User could delete/remove any task in the list
- No need to manage task creation time
- Get all tasks of user
GET /tasks
Request
--------
Header::Authorization: Bearer <username>
Response
--------
[
{ "taskid": "abc...", "description": "...", "status": "..." },
{ "taskid": "xyz...", "description": "...", "status": "..." }
]
- Add task
POST /tasks
Request
-------
Header::Authorization: Bearer <username>
Header::Content-Type: application/json
Body: {
"description": "new task"
}
- Update task status
PUT /tasks/<task_id>/status
Request
-------
Header::Authorization: Bearer <username>
Header::Content-Type: application/json
Body: {
"status": 1 # 1: doing; 2: done
}
- Now, we need to manage the emergency of a task (true or false)
- To keep focused, each user could only have 3 doing tasks at a time, but if he has a really urgent task, he could add 1 and only 1 emergency task to having 4 concurrency doing tasks
- If a user has finished at least 3 tasks in his lifetime usage, he could have up to 5 concurrent doing tasks
Collection User {
username: "joe",
tasks: [
{
id: "...",
desc: "...",
state: "...",
emergency: 1 # 1: yes; 0: no
}, {
...
}
]
}