| | 1 | == Writer Archives a Story |
| | 2 | |
| | 3 | === Actor: **Writer** |
| | 4 | A writer decides to archive a published story, making it no longer visible to regular users and guests but keeping it in the system. |
| | 5 | |
| | 6 | **1.** The writer navigates to their story management dashboard. |
| | 7 | |
| | 8 | **2.** The system displays all stories with their current statuses. |
| | 9 | {{{#!sql |
| | 10 | SELECT s.story_id, s.short_description, st.status, |
| | 11 | COUNT(DISTINCT c.chapter_id) AS total_chapters, |
| | 12 | COUNT(DISTINCT l.user_id) AS total_likes |
| | 13 | FROM STORY s |
| | 14 | JOIN STATUS st ON s.story_id = st.story_id |
| | 15 | LEFT JOIN CHAPTER c ON s.story_id = c.story_id |
| | 16 | LEFT JOIN LIKES l ON s.story_id = l.story_id |
| | 17 | WHERE s.user_id = 2 |
| | 18 | GROUP BY s.story_id, st.status; |
| | 19 | }}} |
| | 20 | |
| | 21 | **3.** The writer selects a published story and chooses the "Archive" option. |
| | 22 | |
| | 23 | **4.**The system updates the story status from published to archived. |
| | 24 | {{{#!sql |
| | 25 | UPDATE STATUS |
| | 26 | SET status = 'archived' |
| | 27 | WHERE story_id = 1 AND status = 'published'; |
| | 28 | }}} |
| | 29 | |
| | 30 | **5.** The system verifies the story no longer appears in public browsing queries. |
| | 31 | {{{#!sql |
| | 32 | SELECT s.story_id, s.short_description, st.status |
| | 33 | FROM STORY s |
| | 34 | JOIN STATUS st ON s.story_id = st.story_id |
| | 35 | WHERE st.status = 'published' AND s.story_id = 1; |
| | 36 | }}} |
| | 37 | |
| | 38 | **6.** The system sends a notification to users who had the story in their reading lists informing them it is no longer available. |
| | 39 | {{{#!sql |
| | 40 | INSERT INTO NOTIFICATION (content, is_read, created_at) |
| | 41 | VALUES ('"The Chronicles of Eldoria" has been archived by the author and is no longer available.', FALSE, CURRENT_TIMESTAMP); |
| | 42 | }}} |
| | 43 | |
| | 44 | **7.** The system confirms the story is archived and updates the writer's dashboard. |