| Version 1 (modified by , 4 days ago) ( diff ) |
|---|
Use-case UC0001 – Admin creates and assigns a task to workers
Initiating actor: Admin
Other actors: Worker (assigned to the task)
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.
Scenario
- Admin chooses "Create Task" and the system shows a form. To populate the project selector, the system lists the available projects:
SELECT p.id, p.name, p.status, u.name AS client FROM project.projects p LEFT JOIN project.users u ON u.id = p.client_id ORDER BY p.id;
- To populate the worker selector, the system lists the available workers with their skills:
SELECT id, name, email, skills FROM project.users WHERE role = 'WORKER' ORDER BY name;
- Admin fills in the task title, description, due date, picks the project from the list, and selects the workers to assign.
- System validates the input and inserts the new task:
INSERT INTO project.tasks (title, description, status, due_date, client_id, project_id) VALUES ('Prepare launch checklist', 'Pre-launch QA checklist', 'PENDING', TIMESTAMP '2026-08-15', 4, 1) RETURNING id, title, status, client_id, project_id; - System inserts the worker assignments into the associative table (one row per selected worker):
INSERT INTO project.task_workers (task_id, user_id) VALUES (11, 2), (11, 7) RETURNING id, task_id, user_id;
- System confirms the task was created and shows it in the task list with its assigned workers.
The 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).
Note:
See TracWiki
for help on using the wiki.
