| | 1 | == Use-case 0013 - Remove a Pet |
| | 2 | |
| | 3 | '''Initiating actor:''' Pet Owner |
| | 4 | |
| | 5 | '''Other actors:''' None |
| | 6 | |
| | 7 | '''Description:''' |
| | 8 | A Pet Owner wants to remove a pet profile from their account. The system securely deletes the pet, verifying that the user requesting the deletion is the actual owner. |
| | 9 | |
| | 10 | '''Scenario:''' |
| | 11 | 1. Pet Owner goes to their "My Pets" dashboard. |
| | 12 | 2. System fetches the pets currently owned by this user: |
| | 13 | {{{ |
| | 14 | #!sql |
| | 15 | SELECT pet_id, name, age |
| | 16 | FROM pets |
| | 17 | WHERE owner_id = (SELECT user_id FROM users WHERE username = 'owner_bojan'); |
| | 18 | }}} |
| | 19 | 3. Owner clicks the "Delete" button next to their pet. |
| | 20 | 4. System executes the deletion, ensuring the owner ID corresponds: |
| | 21 | {{{ |
| | 22 | #!sql |
| | 23 | DELETE FROM pets |
| | 24 | WHERE name = 'Sharka' |
| | 25 | AND owner_id = (SELECT user_id FROM users WHERE username = 'owner_bojan'); |
| | 26 | }}} |