| | 1 | == Use-case 0007 - Accept a Booking |
| | 2 | |
| | 3 | '''Initiating actor:''' Pet Sitter |
| | 4 | |
| | 5 | '''Other actors:''' Pet Owner |
| | 6 | |
| | 7 | '''Description:''' |
| | 8 | A Pet Sitter logs in and sees they have a new pending booking request. They review the dates, the requested service, and decide to accept the job. The system updates the booking status. |
| | 9 | |
| | 10 | '''Scenario:''' |
| | 11 | 1. Pet Sitter goes to their "Pending Requests" dashboard. |
| | 12 | 2. System fetches all bookings assigned to them that are still pending: |
| | 13 | {{{ |
| | 14 | #!sql |
| | 15 | SELECT booking_id, date_from, date_to, address |
| | 16 | FROM bookings |
| | 17 | WHERE sitter_id = (SELECT user_id FROM users WHERE username = 'sitter_filip') |
| | 18 | AND status = 'PENDING'; |
| | 19 | }}} |
| | 20 | 3. Sitter clicks the "Accept Booking" button on a specific request. |
| | 21 | 4. System updates the status of the booking in the database to CONFIRMED: |
| | 22 | {{{ |
| | 23 | #!sql |
| | 24 | UPDATE bookings |
| | 25 | SET status = 'CONFIRMED' |
| | 26 | WHERE booking_id = ( |
| | 27 | SELECT booking_id FROM bookings |
| | 28 | WHERE status = 'PENDING' |
| | 29 | AND sitter_id = (SELECT user_id FROM users WHERE username = 'sitter_filip') |
| | 30 | LIMIT 1 |
| | 31 | ); |
| | 32 | }}} |