| Version 1 (modified by , 2 weeks ago) ( diff ) |
|---|
Regular User Comments on a Story
Authors: 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.content, c.created_at FROM COMMENT c JOIN USERS u ON c.user_id = u.user_id WHERE c.story_id = 1 ORDER BY c.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 (content, user_id, story_id, created_at, 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 (content, is_read, created_at)
VALUES ('Sara commented on your story "The Chronicles of Eldoria"', FALSE, CURRENT_TIMESTAMP);
6. The system records the notification type.
INSERT INTO CONTENT_TYPE (notification_id, content_type) VALUES (2, 'comment');
7. The system links the notification to the writer.
INSERT INTO NOTIFY (user_id, story_id, notification_id) VALUES (2, 1, 2);
8. The system displays the new comment immediately under the story.
Note:
See TracWiki
for help on using the wiki.
