Changes between Initial Version and Version 1 of UseCase0012


Ignore:
Timestamp:
01/07/26 23:51:03 (45 hours ago)
Author:
213257
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase0012

    v1 v1  
     1== Use-case 0012 - Book Appointment for Viewing
     2
     3'''Initiating actor:''' Client
     4
     5'''Other actors:''' Agent
     6
     7'''Description:'''
     8
     9A client books an appointment to physically view an apartment unit. This reserves a timeslot with an agent and marks the slot as booked.
     10
     11'''Scenario:'''
     12
     131. Client navigates to booking page for unit 101 in Golden Tower.
     14
     152. System displays available agents and timeslots:
     16{{{
     17SELECT
     18    a.agent_id,
     19    a.name AS agent_name,
     20    a.email,
     21    t.timeslot_id,
     22    t.date,
     23    t.time_start,
     24    t.time_end
     25FROM agent a
     26JOIN timeslot t ON a.agent_id = t.agent_id
     27WHERE t.status = 'Available'
     28AND t.date >= CURRENT_DATE
     29ORDER BY a.name, t.date, t.time_start;
     30}}}
     31
     323. Client selects agent "Teodora" and timeslot "Jan 9, 2025 at 10:00 AM".
     33
     344. System displays booking confirmation form with unit, date/time, and agent details.
     35
     365. Client enters their information (name, email and phone number):  Marko Petrovski, marko.p@gmail.com, +389 70 123 456.
     37
     386. System creates a client record if there are no previous records with the same email:
     39{{{
     40INSERT INTO client (name, email, phone)
     41VALUES ('Marko Petrovski', 'marko.p@gmail.com', '+389 70 123 456')
     42ON CONFLICT (email) DO NOTHING;
     43}}}
     44
     457. Client clicks "Confirm Appointment".
     46
     478. System verifies that the timeslot is available:
     48{{{
     49SELECT status
     50FROM timeslot
     51WHERE timeslot_id = (
     52    SELECT timeslot_id FROM timeslot
     53    WHERE date = '2025-01-10'
     54    AND time_start = '10:00:00'
     55    AND agent_id = (SELECT agent_id FROM agent WHERE name = 'Teodora')
     56);
     57}}}
     58
     599. System creates the appointment:
     60{{{
     61INSERT INTO appointment (status, client_id, unit_id, timeslot_id, agent_id)
     62VALUES (
     63    'Scheduled',
     64    (SELECT client_id FROM client WHERE email = 'marko.p@gmail.com'),
     65    (
     66     SELECT unit_id FROM unit WHERE unit_number = '101'
     67     AND floor_id = (
     68                     SELECT floor_id FROM floor
     69                     WHERE building_id = (SELECT building_id FROM building WHERE name = 'Golden Tower')
     70                     AND floor_number = 1)
     71    ),
     72    (
     73     SELECT timeslot_id FROM timeslot
     74     WHERE date = '2025-01-10'
     75     AND time_start = '10:00:00'
     76     AND agent_id = (SELECT agent_id FROM agent WHERE name = 'Teodora')
     77     ),
     78    (SELECT agent_id FROM agent WHERE name = 'Teodora')
     79);
     80}}}
     81
     8210. System updates timeslot to booked:
     83{{{
     84UPDATE timeslot
     85SET status = 'Booked'
     86WHERE timeslot_id = (SELECT timeslot_id FROM timeslot
     87                     WHERE date = '2025-01-10'
     88                     AND time_start = '10:00:00'
     89                     AND agent_id = (SELECT agent_id FROM agent WHERE name = 'Teodora'));
     90}}}
     91
     9211. System displays confirmation with appointment details.