| | 1 | == Use-case 0005 - Leave a Review |
| | 2 | |
| | 3 | '''Initiating actor:''' Pet Owner |
| | 4 | |
| | 5 | '''Other actors:''' Pet Sitter |
| | 6 | |
| | 7 | '''Description:''' |
| | 8 | After a booking has successfully finished, the Pet Owner can submit a review about the Pet Sitter. The owner leaves a rating out of 5 and a comment. The system links this review directly to the completed booking. |
| | 9 | |
| | 10 | '''Scenario:''' |
| | 11 | 1. Pet Owner goes to their "Past Bookings" page. |
| | 12 | 2. System fetches all bookings that belong to this owner to display on the screen: |
| | 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 | ORDER BY date_from DESC; |
| | 19 | }}} |
| | 20 | 3. Owner clicks "Leave a Review" on a specific completed booking. |
| | 21 | 4. Owner enters a 5 star rating, types a comment, and clicks submit. |
| | 22 | 5. System creates the review record attached to that exact transaction: |
| | 23 | {{{ |
| | 24 | #!sql |
| | 25 | INSERT INTO reviews (rating, comment, booking_id) |
| | 26 | VALUES ( |
| | 27 | 5, |
| | 28 | 'Filip was amazing! Sharka loved her walks.', |
| | 29 | (SELECT booking_id FROM bookings WHERE address = 'ul. Partizanska br. 10, Skopje' LIMIT 1) |
| | 30 | ); |
| | 31 | }}} |