| | 1 | == Use-case 0014 - Cancel a Pending Booking |
| | 2 | |
| | 3 | '''Initiating actor:''' Pet Owner |
| | 4 | |
| | 5 | '''Other actors:''' None |
| | 6 | |
| | 7 | '''Description:''' |
| | 8 | An owner decides they no longer need a sitter and cancels a pending booking request before the sitter accepts it or before payment is made. |
| | 9 | |
| | 10 | '''Scenario:''' |
| | 11 | 1. Pet Owner navigates to their "My Bookings" page. |
| | 12 | 2. System fetches the owner's current pending bookings: |
| | 13 | {{{ |
| | 14 | #!sql |
| | 15 | SELECT booking_id, date_from, address, status |
| | 16 | FROM bookings |
| | 17 | WHERE owner_id = (SELECT user_id FROM users WHERE username = 'owner_bojan') |
| | 18 | AND status = 'PENDING'; |
| | 19 | }}} |
| | 20 | 3. Owner clicks the "Cancel Request" button. |
| | 21 | 4. System updates the booking status: |
| | 22 | {{{ |
| | 23 | #!sql |
| | 24 | UPDATE bookings |
| | 25 | SET status = 'CANCELLED' |
| | 26 | WHERE booking_id = ( |
| | 27 | SELECT booking_id FROM bookings |
| | 28 | WHERE status = 'PENDING' |
| | 29 | AND owner_id = (SELECT user_id FROM users WHERE username = 'owner_bojan') |
| | 30 | LIMIT 1 |
| | 31 | ); |
| | 32 | }}} |