Skip to content

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

  1. User opens the edit form for an existing Task, modifies fields, and submits.
  2. System looks up the Task by id.
  3. System validates the request body against BR-001, BR-002, BR-003, BR-004, BR-006.
  4. System applies the new values to the Task (excluding id and createdAt).
  5. System persists the updated Task.
  6. System responds with HTTP 200 and the updated Task.
  7. System reflects the changes in the task list.

Extensions (Alternate Flows)

2a. No task with the given ID exists:

  1. System returns HTTP 404 with error code TASK_NOT_FOUND.
  2. UI displays an error message.
  3. Use case ends in failure; no data is changed.

3a. Title is blank (BR-001 violated):

  1. System returns HTTP 400 with error code TASK_TITLE_REQUIRED.
  2. UI displays the error on the title field.
  3. Use case ends in failure.

3b. Title exceeds 100 characters (BR-002 violated):

  1. System returns HTTP 400 with error code TASK_TITLE_TOO_LONG.
  2. Use case ends in failure.

3c. Description exceeds 500 characters (BR-003 violated):

  1. System returns HTTP 400 with error code TASK_DESCRIPTION_TOO_LONG.
  2. Use case ends in failure.

3d. Due date is not a valid date (BR-006 violated):

  1. System returns HTTP 400 with error code TASK_DUE_DATE_INVALID.
  2. 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.