Changes between Initial Version and Version 1 of UserBrowsesStoriesByGenre


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

--

Legend:

Unmodified
Added
Removed
Modified
  • UserBrowsesStoriesByGenre

    v1 v1  
     1==  Guest/User Browses Stories by Genre
     2
     3=== Actor: **Regular User / Guest User**
     4A user browses the platform filtering published stories by a specific genre to discover new content.
     5
     6**1.** The user navigates to the "Browse by Genre" section of the platform.
     7
     8**2.** The system retrieves and displays all available genres.
     9{{{#!sql
     10SELECT g.genre_id, g.name, COUNT(hg.story_id) AS total_stories
     11FROM GENRE g
     12LEFT JOIN HAS_GENRE hg ON g.genre_id = hg.genre_id
     13GROUP BY g.genre_id
     14ORDER BY total_stories DESC;
     15}}}
     16
     17**3.** The user selects a genre, for example "Fantasy".
     18
     19**4.** The system retrieves all published stories that belong to that genre.
     20{{{#!sql
     21SELECT s.story_id, s.short_description, s.mature_content, s.image,
     22       u.username AS author,
     23       COUNT(DISTINCT l.user_id) AS total_likes,
     24       COUNT(DISTINCT c.comment_id) AS total_comments
     25FROM STORY s
     26JOIN HAS_GENRE hg ON s.story_id = hg.story_id
     27JOIN GENRE g ON hg.genre_id = g.genre_id
     28JOIN USERS u ON s.user_id = u.user_id
     29JOIN STATUS st ON s.story_id = st.story_id
     30LEFT JOIN LIKES l ON s.story_id = l.story_id
     31LEFT JOIN COMMENT c ON s.story_id = c.story_id
     32WHERE g.name = 'Fantasy' AND st.status = 'published'
     33GROUP BY s.story_id, u.username
     34ORDER BY total_likes DESC;
     35}}}
     36
     37**5.** The system displays the filtered list of stories with their cover image, author, likes, and comment count.
     38
     39**6.** The user clicks on a story to view its details.