| | 1 | == Use-case 0012 - Search for Sitters by Service |
| | 2 | |
| | 3 | '''Initiating actor:''' Pet Owner |
| | 4 | |
| | 5 | '''Other actors:''' None |
| | 6 | |
| | 7 | '''Description:''' |
| | 8 | A Pet Owner needs a specific service and wants to find sitters who offer it. The system filters the registered sitters based on the service selected by the owner. |
| | 9 | |
| | 10 | '''Scenario:''' |
| | 11 | 1. Pet Owner navigates to the "Find a Sitter" search page. |
| | 12 | 2. System fetches all available services to populate the search dropdown: |
| | 13 | {{{ |
| | 14 | #!sql |
| | 15 | SELECT type FROM services ORDER BY type ASC; |
| | 16 | }}} |
| | 17 | 3. Owner selects "Dog Walking" from the dropdown and clicks "Search". |
| | 18 | 4. System joins the tables to find sitters who offer that exact service: |
| | 19 | {{{ |
| | 20 | #!sql |
| | 21 | SELECT u.user_id, u.first_name, u.last_name, u.email |
| | 22 | FROM users u |
| | 23 | JOIN pet_sitters ps ON u.user_id = ps.user_id |
| | 24 | JOIN sitter_services ss ON ps.user_id = ss.sitter_id |
| | 25 | JOIN services s ON ss.service_id = s.service_id |
| | 26 | WHERE s.type = 'Dog Walking'; |
| | 27 | }}} |