| | 1 | == Writer Publishes a Story |
| | 2 | |
| | 3 | === Authors: **Writter** |
| | 4 | A writer changes the status of a story from draft to published, making it visible to all users on the platform. |
| | 5 | |
| | 6 | **1.** The writer navigates to their story management page and selects a story with draft status. |
| | 7 | |
| | 8 | **2.** The system displays the current story details and status. |
| | 9 | {{{#!sql |
| | 10 | SELECT s.story_id, s.short_description, st.status |
| | 11 | FROM STORY s |
| | 12 | JOIN STATUS st ON s.story_id = st.story_id |
| | 13 | WHERE s.user_id = 2 AND st.status = 'draft'; |
| | 14 | }}} |
| | 15 | |
| | 16 | **3.** The writer selects the option to publish the story. |
| | 17 | |
| | 18 | **4.** The system updates the story status from draft to published. |
| | 19 | {{{#!sql |
| | 20 | UPDATE STATUS |
| | 21 | SET status = 'published' |
| | 22 | WHERE story_id = 1 AND status = 'draft'; |
| | 23 | }}} |
| | 24 | |
| | 25 | **5.** The system sends a notification to all users who follow the writer. |
| | 26 | |
| | 27 | {{{#!sql |
| | 28 | INSERT INTO NOTIFICATION (content, is_read, created_at) |
| | 29 | VALUES ('Elena published a new story "The Chronicles of Eldoria"', FALSE, CURRENT_TIMESTAMP); |
| | 30 | }}} |
| | 31 | |
| | 32 | **6.** The system confirms the story is now publicly visible on the platform. |