UC004: Update Task¶
Overview¶
| Property | Value |
|---|---|
| ID | UC004 |
| Level | User Goal |
| Primary Actor | User |
| Trigger | User submits the "Edit Task" form or changes the status via dropdown. |
| Precondition | The Task with the given id exists in the system. |
| Success Guarantee | The Task is updated with the new values; id and createdAt are unchanged. |
| Related Rules | BR-001, BR-002, BR-003, BR-004, BR-005, BR-006 |
| Related Feature | features/UC004-update-task.feature |
Goal¶
The User wants to change the title, description, status, or dueDate of an existing Task.
A full replacement strategy is used (PUT): the request body must contain all editable fields.
The id and createdAt fields are never updated (BR-005).
Main Success Scenario¶
- User opens the edit form for an existing
Task, modifies fields, and submits. - System looks up the
Taskbyid. - System validates the request body against BR-001, BR-002, BR-003, BR-004, BR-006.
- System applies the new values to the
Task(excludingidandcreatedAt). - System persists the updated
Task. - System responds with HTTP 200 and the updated
Task. - System reflects the changes in the task list.
Extensions (Alternate Flows)¶
2a. No task with the given ID exists:
- System returns HTTP 404 with error code
TASK_NOT_FOUND. - UI displays an error message.
- Use case ends in failure; no data is changed.
3a. Title is blank (BR-001 violated):
- System returns HTTP 400 with error code
TASK_TITLE_REQUIRED. - UI displays the error on the title field.
- Use case ends in failure.
3b. Title exceeds 100 characters (BR-002 violated):
- System returns HTTP 400 with error code
TASK_TITLE_TOO_LONG. - Use case ends in failure.
3c. Description exceeds 500 characters (BR-003 violated):
- System returns HTTP 400 with error code
TASK_DESCRIPTION_TOO_LONG. - Use case ends in failure.
3d. Due date is not a valid date (BR-006 violated):
- System returns HTTP 400 with error code
TASK_DUE_DATE_INVALID. - Use case ends in failure.
Transaction Boundary¶
Single DB transaction covering find → validate → update → save of the Task aggregate.
No distributed transaction required.
Sequence Diagram¶
BDD Scenarios¶
The feature file is the single source of truth for behaviour — it is also executed as an acceptance test. See features/UC004-update-task.feature.