Changes between Initial Version and Version 1 of UseCase0001


Ignore:
Timestamp:
07/01/26 16:40:54 (5 days ago)
Author:
221544
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase0001

    v1 v1  
     1= Use-case UC0001 – Admin creates and assigns a task to workers =
     2
     3'''Initiating actor:''' Admin
     4
     5'''Other actors:''' Worker (assigned to the task)
     6
     7'''Description:''' The Admin creates a new task under an existing project and assigns one or more workers to carry it out. So the Admin never has to remember identifiers, the system first lists the available projects and workers to choose from; the task and its worker assignments are then written to the database.
     8
     9== Scenario ==
     10
     11 1. '''Admin''' chooses "Create Task" and the system shows a form. To populate the project selector, the '''system''' lists the available projects:
     12{{{
     13#!sql
     14SELECT p.id, p.name, p.status, u.name AS client
     15FROM project.projects p
     16LEFT JOIN project.users u ON u.id = p.client_id
     17ORDER BY p.id;
     18}}}
     19 2. To populate the worker selector, the '''system''' lists the available workers with their skills:
     20{{{
     21#!sql
     22SELECT id, name, email, skills
     23FROM project.users
     24WHERE role = 'WORKER'
     25ORDER BY name;
     26}}}
     27 3. '''Admin''' fills in the task title, description, due date, picks the project from the list, and selects the workers to assign.
     28 4. '''System''' validates the input and inserts the new task:
     29{{{
     30#!sql
     31INSERT INTO project.tasks (title, description, status, due_date, client_id, project_id)
     32VALUES ('Prepare launch checklist', 'Pre-launch QA checklist', 'PENDING',
     33        TIMESTAMP '2026-08-15', 4, 1)
     34RETURNING id, title, status, client_id, project_id;
     35}}}
     36 5. '''System''' inserts the worker assignments into the associative table (one row per selected worker):
     37{{{
     38#!sql
     39INSERT INTO project.task_workers (task_id, user_id)
     40VALUES (11, 2), (11, 7)
     41RETURNING id, task_id, user_id;
     42}}}
     43 6. '''System''' confirms the task was created and shows it in the task list with its assigned workers.
     44
     45The task INSERT and the worker-assignment INSERTs are executed together in one transaction, so a task is never created without its assignments (or vice versa).