Changes between Initial Version and Version 1 of RegularUserCommentsOnStory


Ignore:
Timestamp:
03/05/26 15:01:02 (2 weeks ago)
Author:
211099
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RegularUserCommentsOnStory

    v1 v1  
     1==  Regular User Comments on a Story
     2
     3=== Authors: ** Regular User**
     4A regular user leaves a comment on a published story, and the writer receives a notification.
     5
     6**1.** The regular user opens a published story and scrolls to the comments section.
     7
     8**2.** The system displays all existing comments for the story.
     9{{{#!sql
     10SELECT c.comment_id, u.username, c.content, c.created_at
     11FROM COMMENT c
     12JOIN USERS u ON c.user_id = u.user_id
     13WHERE c.story_id = 1
     14ORDER BY c.created_at DESC;
     15}}}
     16
     17**3.** The user types a comment and submits it.
     18
     19**4.** The system inserts the new comment into the COMMENT table.
     20{{{#!sql
     21INSERT INTO COMMENT (content, user_id, story_id, created_at, updated_at)
     22VALUES ('This is absolutely breathtaking! The world-building is incredible!', 4, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
     23}}}
     24
     25**5.** The system creates a notification for the writer.
     26{{{#!sql
     27INSERT INTO NOTIFICATION (content, is_read, created_at)
     28VALUES ('Sara commented on your story "The Chronicles of Eldoria"', FALSE, CURRENT_TIMESTAMP);
     29}}}
     30
     31**6.** The system records the notification type.
     32{{{#!sql
     33INSERT INTO CONTENT_TYPE (notification_id, content_type)
     34VALUES (2, 'comment');
     35}}}
     36
     37**7.** The system links the notification to the writer.
     38{{{#!sql
     39INSERT INTO NOTIFY (user_id, story_id, notification_id)
     40VALUES (2, 1, 2);
     41}}}
     42
     43**8.** The system displays the new comment immediately under the story.