| | 1 | == Use-case 0009 - Delete User |
| | 2 | |
| | 3 | '''Initiating actor:''' Admin |
| | 4 | |
| | 5 | '''Other actors:''' Pet Owner / Pet Sitter |
| | 6 | |
| | 7 | '''Description:''' |
| | 8 | The Admin moderates the platform by reviewing the user behavior. If a user is problematic, the admin can completely remove them from the platform. Because the database uses CASCADE delete rules, deleting the user automatically cleans up their pets, bookings, and reviews. |
| | 9 | |
| | 10 | '''Scenario:''' |
| | 11 | 1. Admin opens the "Manage Users" dashboard. |
| | 12 | 2. System fetches a list of all registered users on the platform: |
| | 13 | {{{ |
| | 14 | #!sql |
| | 15 | SELECT user_id, username, first_name, last_name, email |
| | 16 | FROM users |
| | 17 | ORDER BY username ASC; |
| | 18 | }}} |
| | 19 | 3. Admin clicks the "Delete User" button next to a specific user they want to remove. |
| | 20 | 4. System executes the deletion, cascading to all related tables: |
| | 21 | {{{ |
| | 22 | #!sql |
| | 23 | DELETE FROM users |
| | 24 | WHERE username = 'owner_marko'; |
| | 25 | }}} |