wiki:RegularUserCommentsOnStory

Version 3 (modified by 211099, 13 days ago) ( diff )

--

Regular User Comments on a Story

Actor: Regular User

A regular user leaves a comment on a published story, and the writer receives a notification.

1. The regular user opens a published story and scrolls to the comments section.

2. The system displays all existing comments for the story.

SELECT c.comment_id, u.username, c.comment_content, c.comment_created_at
FROM COMMENT c
JOIN USERS u ON c.user_id = u.user_id
WHERE c.story_id = 1
ORDER BY c.comment_created_at DESC;

3. The user types a comment and submits it.

4. The system inserts the new comment into the COMMENT table.

INSERT INTO COMMENT (comment_content, user_id, story_id, comment_created_at, comment_updated_at)
VALUES ('This is absolutely breathtaking! The world-building is incredible!', 4, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);

5. The system creates a notification for the writer.

INSERT INTO NOTIFICATION (notification_content, content_type, is_read, user_id, story_id, notification_created_at)
VALUES ('Sara commented on your story "The Chronicles of Eldoria"', 'comment', FALSE, 2, 1, CURRENT_TIMESTAMP);

6. The system displays the new comment immediately under the story.

Note: See TracWiki for help on using the wiki.