| | 1 | = Use-case UC0002 – Client views project and task status = |
| | 2 | |
| | 3 | '''Initiating actor:''' Client |
| | 4 | |
| | 5 | '''Other actors:''' – |
| | 6 | |
| | 7 | '''Description:''' The Client logs in to check the progress of the work being done for them. The system shows the Client's own projects and, for a selected project, the tasks within it together with their status and the workers assigned. |
| | 8 | |
| | 9 | == Scenario == |
| | 10 | |
| | 11 | 1. '''Client''' opens their dashboard. The '''system''' lists the projects that belong to this client: |
| | 12 | {{{ |
| | 13 | #!sql |
| | 14 | SELECT id, name, status, service_type, created_at::date AS created |
| | 15 | FROM project.projects |
| | 16 | WHERE client_id = 4 |
| | 17 | ORDER BY created_at DESC; |
| | 18 | }}} |
| | 19 | 2. '''Client''' selects one of their projects to see its tasks. |
| | 20 | 3. '''System''' lists the tasks in that project with status, due date, and the assigned workers: |
| | 21 | {{{ |
| | 22 | #!sql |
| | 23 | SELECT t.id, t.title, t.status, |
| | 24 | t.due_date::date AS due_date, |
| | 25 | COALESCE(string_agg(u.name, ', ' ORDER BY u.name), '(unassigned)') AS assigned_workers |
| | 26 | FROM project.tasks t |
| | 27 | LEFT JOIN project.task_workers tw ON tw.task_id = t.id |
| | 28 | LEFT JOIN project.users u ON u.id = tw.user_id |
| | 29 | WHERE t.project_id = 1 |
| | 30 | GROUP BY t.id, t.title, t.status, t.due_date |
| | 31 | ORDER BY t.id; |
| | 32 | }}} |
| | 33 | 4. '''System''' displays the task list; the Client can see, for example, that "Develop landing page" is assigned to Bojan Ilievski and Ivana Petrova, while "Set up hosting" is still unassigned. |
| | 34 | |
| | 35 | The LEFT JOINs ensure that tasks with no assigned workers still appear (shown as "(unassigned)"), and string_agg collapses the many-to-many worker assignments into one readable column. |