| | 1 | == Writer Views Story Collaboration Details |
| | 2 | |
| | 3 | === Authors: **Writer** |
| | 4 | A writer views all current collaborators on their story, including their roles and permission levels, and can manage the collaboration. |
| | 5 | |
| | 6 | **1.** The writer navigates to their story management page and selects "Manage Collaborators". |
| | 7 | |
| | 8 | **2.** The system retrieves all collaborators and their details for the story. |
| | 9 | {{{#!sql |
| | 10 | SELECT u.username, u.name, u.surname, r.roles, p.permission_level, c.created_at |
| | 11 | FROM COLLABORATION c |
| | 12 | JOIN USERS u ON c.user_id = u.user_id |
| | 13 | JOIN ROLES r ON c.user_id = r.user_id AND c.story_id = r.story_id |
| | 14 | JOIN PERMISSION_LEVEL p ON c.user_id = p.user_id AND c.story_id = p.story_id |
| | 15 | WHERE c.story_id = 5 |
| | 16 | ORDER BY p.permission_level DESC; |
| | 17 | }}} |
| | 18 | |
| | 19 | **3.** The writer decides to update a collaborator's permission level. |
| | 20 | {{{#!sql |
| | 21 | UPDATE PERMISSION_LEVEL |
| | 22 | SET permission_level = 3 |
| | 23 | WHERE user_id = 9 AND story_id = 5; |
| | 24 | }}} |
| | 25 | |
| | 26 | **4.** The writer decides to remove a collaborator from the story entirely. |
| | 27 | {{{#!sql |
| | 28 | DELETE FROM COLLABORATION |
| | 29 | WHERE user_id = 9 AND story_id = 5; |
| | 30 | }}} |
| | 31 | |
| | 32 | **5.** The system confirms the changes and the ROLES and PERMISSION_LEVEL records are automatically removed via CASCADE. |
| | 33 | |
| | 34 | **6.** The system sends a notification to the removed collaborator. |
| | 35 | {{{#!sql |
| | 36 | INSERT INTO NOTIFICATION (content, is_read, created_at) |
| | 37 | VALUES ('You have been removed as a collaborator from "Letters from Constantinople"', FALSE, CURRENT_TIMESTAMP); |
| | 38 | }}} |
| | 39 | }}} |