Changes between Initial Version and Version 1 of UseCase04


Ignore:
Timestamp:
05/08/26 03:06:01 (4 hours ago)
Author:
181201
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase04

    v1 v1  
     1== Use-case 0004 - Create a Booking
     2
     3'''Initiating actor:''' Pet Owner
     4
     5'''Other actors:''' Pet Sitter
     6
     7'''Description:'''
     8A Pet Owner finds a Pet Sitter they like and requests a booking. They must select the specific service they want. The system creates the booking and links the requested services using a secure database transaction.
     9
     10'''Scenario:'''
     11 1. Pet Owner views the profile of a sitter (e.g., `sitter_filip`) and clicks "Request Booking".
     12 2. System provides the specific services that this sitter offers to display in the booking form:
     13{{{
     14#!sql
     15SELECT s.service_id, s.type, s.description
     16FROM services s
     17JOIN sitter_services ss ON s.service_id = ss.service_id
     18WHERE ss.sitter_id = (SELECT user_id FROM users WHERE username = 'sitter_filip');
     19}}}
     20 3. Owner fills out the dates, location, selects the service, and submits.
     21 4. System creates the booking with a 'PENDING' status and attaches the requested service simultaneously:
     22{{{
     23#!sql
     24BEGIN;
     25
     26WITH new_booking AS (
     27    INSERT INTO bookings (status, date_from, date_to, address, owner_id, sitter_id)
     28    VALUES (
     29        'PENDING', '2026-06-10', '2026-06-12', 'ul. Partizanska br. 10',
     30        (SELECT user_id FROM users WHERE username = 'owner_bojan'),
     31        (SELECT user_id FROM users WHERE username = 'sitter_filip')
     32    )
     33    RETURNING booking_id
     34)
     35INSERT INTO booking_services (booking_id, service_id)
     36SELECT nb.booking_id, (SELECT service_id FROM services WHERE type = 'Dog Walking')
     37FROM new_booking nb;
     38
     39COMMIT;
     40}}}