| | 1 | = UseCase09 - Add an Animal |
| | 2 | ** Initiating actor: Client ** |
| | 3 | == Description |
| | 4 | A client adds a new pet to their profile by filling in an “Add Pet” form. The client must upload a pet photo. With this the client now becomes an owner. |
| | 5 | == Scenario |
| | 6 | 1. Client goes to his profile. |
| | 7 | 2. Clicks the button "Add new pet". |
| | 8 | 3. Fills in the form provided. |
| | 9 | 4. Submits it. |
| | 10 | {{{ |
| | 11 | |
| | 12 | INSERT INTO owners (user_id) |
| | 13 | SELECT user_id |
| | 14 | FROM users |
| | 15 | WHERE username = 'client.viktor'; |
| | 16 | |
| | 17 | INSERT INTO animals ( |
| | 18 | owner_id, |
| | 19 | name, |
| | 20 | sex, |
| | 21 | date_of_birth, |
| | 22 | photo_url, |
| | 23 | type, |
| | 24 | species, |
| | 25 | breed, |
| | 26 | located_name |
| | 27 | ) |
| | 28 | VALUES ( |
| | 29 | (SELECT user_id FROM users WHERE username = 'client.viktor'), |
| | 30 | 'Bella', |
| | 31 | 'FEMALE', |
| | 32 | '2022-04-15', |
| | 33 | 'https://cdn.petify.com/pets/bella.jpg', |
| | 34 | 'PET', |
| | 35 | 'Dog', |
| | 36 | 'Golden Retriever', |
| | 37 | 'Skopje' |
| | 38 | ); |
| | 39 | }}} |
| | 40 | 5. The system sends a notification. |
| | 41 | {{{ |
| | 42 | INSERT INTO notifications (user_id, type, message) |
| | 43 | VALUES ( |
| | 44 | (SELECT user_id FROM users WHERE username = 'client.viktor'), |
| | 45 | 'PET', |
| | 46 | 'Your pet Bella has been successfully added to your profile.' |
| | 47 | ); |
| | 48 | }}} |
| | 49 | |