| Version 1 (modified by , 2 weeks ago) ( diff ) |
|---|
User Reads a Chapter
Actor: Guest User / Regular User / Writer
A user opens and reads a specific chapter of a story, and the system records the view count for that chapter. 1. The user selects a chapter from the story page.
2. The system retrieves the full chapter content.
SELECT chapter_id, chapter_number, chapter_name, title,
content, word_count, rating, published_at, view_count
FROM CHAPTER
WHERE chapter_id = 1 AND story_id = 1;
3. The system increments the view count for that chapter.
UPDATE CHAPTER
SET view_count = view_count + 1,
updated_at = CURRENT_TIMESTAMP
WHERE chapter_id = 1;
4. The system displays navigation buttons to the previous and next chapters.
SELECT chapter_id, chapter_number, title
FROM CHAPTER
WHERE story_id = 1
AND chapter_number IN (
(SELECT chapter_number - 1 FROM CHAPTER WHERE chapter_id = 1),
(SELECT chapter_number + 1 FROM CHAPTER WHERE chapter_id = 1)
)
ORDER BY chapter_number ASC;
5.The user finishes reading and navigates to the next chapter.
Note:
See TracWiki
for help on using the wiki.
