Changes between Initial Version and Version 1 of AdminManagesGenres


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

--

Legend:

Unmodified
Added
Removed
Modified
  • AdminManagesGenres

    v1 v1  
     1==  Admin Manages Genres
     2
     3=== Actor: **Admin**
     4An admin adds a new genre to the platform or removes an existing one that is no longer needed.
     5
     6**1.** The admin navigates to the "Manage Genres" section in the admin dashboard.
     7
     8**2.** The system displays all existing genres and their usage counts.
     9{{{#!sql
     10SELECT g.genre_id, g.name, COUNT(hg.story_id) AS stories_using_genre
     11FROM GENRE g
     12LEFT JOIN HAS_GENRE hg ON g.genre_id = hg.genre_id
     13GROUP BY g.genre_id
     14ORDER BY g.name ASC;
     15}}}
     16
     17**3.** The admin selects "Add New Genre" and enters the genre name.
     18
     19**4.** The system checks if the genre already exists.
     20{{{#!sql
     21SELECT * FROM GENRE
     22WHERE LOWER(name) = LOWER('Science Fiction');
     23}}}
     24
     25**5.** The genre does not exist, so the system inserts it.
     26{{{#!sql
     27INSERT INTO GENRE (name)
     28VALUES ('Science Fiction');
     29}}}
     30
     31**6.** The admin also decides to delete an unused genre.
     32
     33**7.** The system checks if any stories are currently using that genre before deleting.
     34{{{#!sql
     35SELECT COUNT(*) AS usage_count
     36FROM HAS_GENRE
     37WHERE genre_id = 10;
     38}}}
     39
     40**8.** Since no stories use it, the system deletes the genre.
     41{{{#!sql
     42DELETE FROM GENRE
     43WHERE genre_id = 10;
     44}}}
     45
     46**9.** The system confirms both changes and refreshes the genre list.