Changes between Initial Version and Version 1 of UserViewsStoryDetailsAndChapters


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

--

Legend:

Unmodified
Added
Removed
Modified
  • UserViewsStoryDetailsAndChapters

    v1 v1  
     1==  User Views Story Details and Chapters
     2
     3=== Actor: **Guest User / Regular User / Writer**
     4 A user opens a published story to view its full details, genres, and list of available chapters before starting to read.
     5
     6**1.** The user clicks on a story from the browse page or reading list.
     7
     8**2.** The system retrieves the full story details.
     9{{{#!sql
     10SELECT s.story_id, s.short_description, s.content, s.mature_content,
     11       s.image, s.created_at, u.username AS author,
     12       st.status
     13FROM STORY s
     14JOIN USERS u ON s.user_id = u.user_id
     15JOIN STATUS st ON s.story_id = st.story_id
     16WHERE s.story_id = 1 AND st.status = 'published';
     17}}}
     18
     19**3.** The system retrieves all genres assigned to the story.
     20{{{#!sql
     21SELECT g.name
     22FROM GENRE g
     23JOIN HAS_GENRE hg ON g.genre_id = hg.genre_id
     24WHERE hg.story_id = 1;
     25}}}
     26
     27**4.** The system retrieves all chapters of the story ordered by chapter number.
     28{{{#!sql
     29SELECT chapter_id, chapter_number, chapter_name, title,
     30       word_count, rating, published_at, view_count
     31FROM CHAPTER
     32WHERE story_id = 1
     33ORDER BY chapter_number ASC;
     34}}}
     35
     36**5.** The system displays the story page with all details, genres, like and comment counts, and the chapter list.
     37{{{#!sql
     38SELECT COUNT(DISTINCT l.user_id) AS total_likes,
     39       COUNT(DISTINCT c.comment_id) AS total_comments
     40FROM STORY s
     41LEFT JOIN LIKES l ON s.story_id = l.story_id
     42LEFT JOIN COMMENT c ON s.story_id = c.story_id
     43WHERE s.story_id = 1
     44GROUP BY s.story_id;
     45}}}
     46
     47**6.** The user selects a chapter to start reading.