Changes between Version 5 and Version 6 of P3


Ignore:
Timestamp:
01/10/26 17:34:36 (10 days ago)
Author:
193284
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • P3

    v5 v6  
    1 = P3 – Application Scenarios for Database Access (SQL)
     1= Phase P3: Application Scenarios for DB Access (SQL)
    22
    3 == Description
    4 This phase demonstrates typical application scenarios for accessing the Wedding Planner database using SQL queries.
    5 The scenarios reflect real tasks such as creating weddings, managing events and guests, tracking attendance, and handling bookings of wedding services.
     3== Use-case model
    64
    7 == Actors / Roles
     5This phase defines the main application use cases and usage scenarios, describing how the implemented database schema will be used by different actors (roles). 
     6The system supports wedding planning activities such as managing weddings, venues, events, guests and bookings (venue, band, photographer), as well as RSVP and attendance tracking.
    87
    9 * **Wedding Planner (User)** 
    10   The main actor who creates and manages weddings, events, guests and bookings.
     8== List of Actors / Roles
    119
    12 * **Guest** 
    13   A person invited to a wedding who can RSVP to events and attend them.
     10 * *Bride / Groom (Wedding owner)* - Registered user who manages the wedding, budget, notes, bookings and guest list.
     11   * [wiki:UseCase0001 UC0001] - User Registration - Create a new account for wedding planning.
     12   * [wiki:UseCase0002 UC0002] - User Login - Access the application using credentials.
     13   * [wiki:UseCase0003 UC0003] - Create Wedding - Create a new wedding with date and budget details.
     14   * [wiki:UseCase0004 UC0004] - Manage Guest List - Add and view guests for the wedding.
     15   * [wiki:UseCase0005 UC0005] - Create Wedding Events - Create and view scheduled events for a wedding.
     16   * [wiki:UseCase0006 UC0006] - Book Venue - Create a venue booking for the wedding date.
     17   * [wiki:UseCase0007 UC0007] - Book Band - Reserve a band for a wedding/reception.
     18   * [wiki:UseCase0008 UC0008] - Book Photographer - Reserve a photographer for the wedding.
    1419
    15 * **Service Provider** 
    16   External providers such as venues, bands, photographers, churches and registrars
    17   whose services are booked for weddings.
     20 * *Guest* - Invited person who is stored in the guest list and can RSVP for specific events.
     21   * [wiki:UseCase0009 UC0009] - RSVP for Event - Submit RSVP response for event invitation.
     22   * [wiki:UseCase0010 UC0010] - View RSVP Status - View guest RSVP statuses per event.
    1823
    19 == Assumptions
    20  * Primary keys are generated by the system (or assigned manually for demonstration purposes).
    21  * table_number in Attendance is optional because not all events require seating arrangements.
    22  * Status values are stored as text (e.g., 'planned', 'confirmed', 'cancelled', 'attending').
    23  * If the DBMS treats USER as a reserved keyword, the table name can be quoted (e.g., "User") or renamed to Users.
     24 * *Wedding Organizer (Assistant)* - Staff role that can manage logistics: events, attendance and seating roles.
     25   * [wiki:UseCase0011 UC0011] - Assign Attendance / Seating - Assign table number and role per guest per event.
     26   * [wiki:UseCase0012 UC0012] - View Event Attendance Summary - View attendance list and stats per event.
    2427
    25 == Scenario 1: Register a new user
    26 Create a new user who will manage weddings in the system.
     28== Use-case model diagram (optional)
    2729
    28 {{{
    29 INSERT INTO User (user_id, first_name, last_name, email, phone_number, gender, birthday)
    30 VALUES (10, 'Jana', 'Trpkovska', 'jana@mail.com', '070123456', 'F', '2002-05-10');
    31 }}}
     30The use-case model diagram is optional. The project provides a relational schema diagram from Phase P2 as an attachment.
    3231
    33 == Scenario 2: Create a wedding for a user
    34 A user creates a wedding record.
     32== Realization details on selection of the most important use cases in the database
    3533
    36 {{{
    37 INSERT INTO Wedding (wedding_id, date, budget, notes, user_id)
    38 VALUES (1, '2026-06-20', 15000, 'Summer wedding', 10);
    39 }}}
     34The most important use cases (documented in more detail with tested SQL scenarios) are:
    4035
    41 === Dialog Form (Scenario 2)
    42 
    43 1. User selects the option "Create new wedding".
    44 2. System displays a form for wedding details (date, budget, notes).
    45 3. User enters wedding data and submits the form.
    46 4. System validates the input.
    47 5. System creates a new wedding record in the database using SQL INSERT.
    48 6. System shows the wedding dashboard for the newly created wedding.
    49 
    50 == Scenario 3: Add events for a wedding
    51 Create wedding-related events such as ceremony and reception.
    52 
    53 {{{
    54 INSERT INTO Event (event_id, event_type, date, start_time, end_time, status, wedding_id)
    55 VALUES
    56 (1, 'Ceremony', '2026-06-20', '12:00:00', '13:00:00', 'planned', 1),
    57 (2, 'Reception', '2026-06-20', '15:00:00', '21:00:00', 'planned', 1);
    58 }}}
    59 
    60 == Scenario 4: Add guests to a wedding
    61 Add invited guests to the wedding.
    62 
    63 {{{
    64 INSERT INTO Guest (guest_id, first_name, last_name, email, wedding_id)
    65 VALUES
    66 (101, 'Ana', 'Petrova', 'ana.p@mail.com', 1),
    67 (102, 'Marko', 'Iliev', 'marko.i@mail.com', 1),
    68 (103, 'Elena', 'Stojanova', NULL, 1);
    69 }}}
    70 
    71 == Scenario 5: Record attendance for an event
    72 Track guest attendance for a specific event. table_number is optional.
    73 
    74 {{{
    75 INSERT INTO Attendance (attendance_id, status, role, table_number, guest_id, event_id)
    76 VALUES
    77 (1, 'attending', 'guest', 5, 101, 2),
    78 (2, 'attending', 'best_man', 1, 102, 2),
    79 (3, 'pending', 'guest', NULL, 103, 2);
    80 }}}
    81 
    82 === Dialog Form (Scenario 5)
    83 
    84 1. User opens the guest list for a selected event.
    85 2. System displays invited guests and attendance options.
    86 3. User selects attendance status and optional table number.
    87 4. System stores the attendance data in the database.
    88 5. System confirms the update and refreshes the attendance overview.
    89 
    90 == Scenario 6: List all weddings for a specific user
    91 Retrieve weddings managed by a given user.
    92 
    93 {{{
    94 SELECT w.wedding_id, w.date, w.budget, w.notes
    95 FROM Wedding w
    96 WHERE w.user_id = 10
    97 ORDER BY w.date;
    98 }}}
    99 
    100 == Scenario 7: List all events for a wedding
    101 Show all events for a selected wedding.
    102 
    103 {{{
    104 SELECT e.event_id, e.event_type, e.date, e.start_time, e.end_time, e.status
    105 FROM Event e
    106 WHERE e.wedding_id = 1
    107 ORDER BY e.date, e.start_time;
    108 }}}
    109 
    110 == Scenario 8: Show guest list for a wedding
    111 Retrieve all guests invited to a wedding.
    112 
    113 {{{
    114 SELECT g.guest_id, g.first_name, g.last_name, g.email
    115 FROM Guest g
    116 WHERE g.wedding_id = 1
    117 ORDER BY g.last_name, g.first_name;
    118 }}}
    119 
    120 == Scenario 9: Attendance overview for an event
    121 List guests with their attendance status and seating information.
    122 
    123 {{{
    124 SELECT g.first_name, g.last_name, a.status, a.role, a.table_number
    125 FROM Attendance a
    126 JOIN Guest g ON a.guest_id = g.guest_id
    127 WHERE a.event_id = 2
    128 ORDER BY a.role, g.last_name;
    129 }}}
    130 
    131 == Scenario 10: Update an event status
    132 Confirm a wedding event.
    133 
    134 {{{
    135 UPDATE Event
    136 SET status = 'confirmed'
    137 WHERE event_id = 1;
    138 }}}
    139 
    140 == Scenario 11: Add venue types and venues
    141 Define venue categories and store available venues.
    142 
    143 {{{
    144 INSERT INTO Venue_Type (type_id, type_name)
    145 VALUES
    146 (1, 'Restaurant'),
    147 (2, 'Hotel'),
    148 (3, 'Event Hall');
    149 }}}
    150 
    151 {{{
    152 INSERT INTO Venue (venue_id, name, location, city, address, capacity, menu, phone_number, price_per_guest, type_id)
    153 VALUES
    154 (1, 'Royal Hall', 'Center', 'Skopje', 'Main Street 10', 250, 'Standard Menu', '021234567', 25.00, 3),
    155 (2, 'Lakeview Hotel', 'Lake Area', 'Ohrid', 'Lake Road 5', 180, NULL, '046111222', 30.00, 2);
    156 }}}
    157 
    158 == Scenario 12: Book a venue for a wedding
    159 Create a venue booking for a specific time interval.
    160 
    161 {{{
    162 INSERT INTO Venue_booking (booking_id, date, start_time, end_time, status, price, wedding_id, venue_id)
    163 VALUES (1, '2026-06-20', '15:00:00', '21:00:00', 'confirmed', 4500.00, 1, 1);
    164 }}}
    165 
    166 === Dialog Form (Scenario 12)
    167 
    168 1. User selects a wedding and opens the venue booking page.
    169 2. System displays available venues and date/time selection.
    170 3. User selects venue and desired time interval.
    171 4. System checks availability using SQL (no overlapping bookings).
    172 5. If available, system creates a venue booking record.
    173 6. System confirms the booking and shows booking details.
    174 
    175 == Scenario 13: Venue booking overview for a wedding
    176 Show venue booking details including venue name.
    177 
    178 {{{
    179 SELECT v.name, vb.date, vb.start_time, vb.end_time, vb.status, vb.price
    180 FROM Venue_booking vb
    181 JOIN Venue v ON vb.venue_id = v.venue_id
    182 WHERE vb.wedding_id = 1
    183 ORDER BY vb.date, vb.start_time;
    184 }}}
    185 
    186 == Scenario 14: Count guests per wedding
    187 Aggregate query useful for planning.
    188 
    189 {{{
    190 SELECT w.wedding_id, COUNT(g.guest_id) AS total_guests
    191 FROM Wedding w
    192 LEFT JOIN Guest g ON w.wedding_id = g.wedding_id
    193 GROUP BY w.wedding_id;
    194 }}}
    195 
    196 == Scenario 15: Estimated venue cost based on guest count
    197 Estimate total cost using price per guest.
    198 
    199 {{{
    200 SELECT w.wedding_id,
    201        v.name AS venue_name,
    202        v.price_per_guest,
    203        COUNT(g.guest_id) AS guest_count,
    204        (v.price_per_guest * COUNT(g.guest_id)) AS estimated_total_cost
    205 FROM Wedding w
    206 JOIN Guest g ON w.wedding_id = g.wedding_id
    207 JOIN Venue v ON v.venue_id = 1
    208 WHERE w.wedding_id = 1
    209 GROUP BY w.wedding_id, v.name, v.price_per_guest;
    210 }}}
    211 
    212 == Scenario 16: RSVP for an event
    213 Store guest responses to event invitations.
    214 
    215 {{{
    216 INSERT INTO Event_RSVP (response_id, status, response_date, guest_id, event_id)
    217 VALUES
    218 (1, 'confirmed', '2026-05-01', 101, 1),
    219 (2, 'declined', '2026-05-02', 103, 1);
    220 }}}
    221 
    222 == Scenario 17: Add a band and book it for a wedding
    223 Register a band and create a booking.
    224 
    225 {{{
    226 INSERT INTO Band (band_id, band_name, genre, equipment, phone_number, price_per_hour)
    227 VALUES (1, 'Midnight Groove', 'Pop', 'Full set', '071999888', 120.00);
    228 }}}
    229 
    230 {{{
    231 INSERT INTO Band_booking (booking_id, date, start_time, end_time, status, wedding_id, band_id)
    232 VALUES (1, '2026-06-20', '18:00:00', '22:00:00', 'confirmed', 1, 1);
    233 }}}
    234 
    235 == Scenario 18: Add a photographer and book them
    236 Store photographer data and booking.
    237 
    238 {{{
    239 INSERT INTO Photographer (photographer_id, name, email, phone_number, price_per_hour)
    240 VALUES (1, 'Studio Lens', 'lens@mail.com', '072333444', 80.00);
    241 }}}
    242 
    243 {{{
    244 INSERT INTO Photographer_booking (booking_id, date, start_time, end_time, status, wedding_id, photographer_id)
    245 VALUES (1, '2026-06-20', '11:00:00', '16:00:00', 'confirmed', 1, 1);
    246 }}}
    247 
    248 == Scenario 19: Add a church and book a ceremony slot
    249 Insert church data and reserve a time slot.
    250 
    251 {{{
    252 INSERT INTO Church (church_id, name, location, contact)
    253 VALUES (1, 'St. Clement', 'Skopje', '02-555-111');
    254 }}}
    255 
    256 {{{
    257 INSERT INTO Church_booking (booking_id, date, start_time, end_time, status, wedding_id, church_id)
    258 VALUES (1, '2026-06-20', '12:00:00', '13:00:00', 'confirmed', 1, 1);
    259 }}}
    260 
    261 == Scenario 20: Add a registrar and book an appointment
    262 Insert registrar information and create a booking.
    263 
    264 {{{
    265 INSERT INTO Registrar (registrar_id, name, contact, location, working_hours)
    266 VALUES (1, 'City Registrar Office', '02-444-222', 'Skopje Center', 'Mon-Fri 08:00-16:00');
    267 }}}
    268 
    269 {{{
    270 INSERT INTO Registrar_booking (booking_id, date, start_time, end_time, status, price, wedding_id, registrar_id)
    271 VALUES (1, '2026-06-18', '10:00:00', '10:30:00', 'confirmed', 30.00, 1, 1);
    272 }}}
    273 
    274 == Scenario 21: Check availability before booking
    275 Verify that a resource is available and prevent overlapping bookings.
    276 
    277 {{{
    278 SELECT *
    279 FROM Venue_booking vb
    280 WHERE vb.venue_id = 1
    281   AND vb.date = '2026-06-20'
    282   AND NOT (vb.end_time <= '15:00:00' OR vb.start_time >= '21:00:00');
    283 }}}
    284 
    285 == Conclusion
    286 These scenarios demonstrate how the database supports complete wedding planning operations,
    287 including user management, event scheduling, guest tracking, service bookings, and availability control.
    288 
    289 
    290 == UX/UI Development Plan ==
    291 The UX/UI page flow is directly aligned with the SQL application scenarios described
    292 in this phase, where each user interaction corresponds to one or more SQL operations.
    293 
    294 This section guides the UX/UI designers on the structure, order, and responsibilities
    295 of the application pages based on the database design and SQL scenarios defined in P3.
    296 
    297 === General Guidelines ===
    298 * The UI should follow the database structure and SQL use cases listed in P3.
    299 * Each major user interaction corresponds directly to one or more database entities
    300   and SQL operations.
    301 * Screens are organized according to the real-world wedding planning workflow:
    302   login → wedding creation → event setup → guest management → bookings → summaries.
    303 
    304 === Suggested Page Flow ===
    305 
    306 1. **User Login / Registration Page**
    307    - User authentication and account creation.
    308    - Based on the User entity.
    309    - Successful login redirects to the Wedding Dashboard.
    310 
    311 2. **Wedding Dashboard**
    312    - Displays all weddings managed by the logged-in user.
    313    - Create, view, edit, or delete weddings.
    314    - Based on the Wedding entity.
    315 
    316 3. **Event Management Page**
    317    - Add, edit, and view events (ceremony, reception, party).
    318    - Event date, time, and status management.
    319    - Based on the Event entity.
    320 
    321 4. **Guest List and Attendance Page**
    322    - Add and manage wedding guests.
    323    - Assign attendance status, roles, and optional table numbers per event.
    324    - Based on Guest and Attendance entities.
    325 
    326 5. **Bookings Page**
    327    - Central page for managing all service bookings.
    328    - Organized into separate tabs or sections for clarity:
    329 
    330      * **Venue Bookings**
    331        - Select venue, date, time, and status.
    332        - Based on Venue and Venue_booking entities.
    333 
    334      * **Church Bookings**
    335        - Select church and ceremony time slot.
    336        - Based on Church and Church_booking entities.
    337 
    338      * **Registrar Bookings**
    339        - Book registrar appointments with optional fee.
    340        - Based on Registrar and Registrar_booking entities.
    341 
    342      * **Band Bookings**
    343        - Select music band and performance time.
    344        - Based on Band and Band_booking entities.
    345 
    346      * **Photographer Bookings**
    347        - Book photographer services for selected time intervals.
    348        - Based on Photographer and Photographer_booking entities.
    349 
    350 6. **Reports / Summary Pages**
    351    - Aggregated and overview information for the wedding:
    352      * Guest count
    353      * Attendance status
    354      * Booked services
    355      * Estimated costs
    356    - Uses aggregate SQL queries from P3.
    357 
    358 === Service Providers Page (Optional but Recommended)
    359 * Dedicated page for browsing and searching service providers:
    360   - Venues
    361   - Bands
    362   - Photographers
    363   - Churches
    364   - Registrars
    365 * Allows filtering and selection before creating bookings.
    366 * Improves usability and separation of concerns in the UI.
    367 
    368 === Interaction-to-SQL Mapping ===
    369 * Wedding creation → `INSERT INTO Wedding`
    370 * Event creation → `INSERT INTO Event`
    371 * Guest management → `INSERT INTO Guest`
    372 * Attendance tracking → `INSERT INTO Attendance`
    373 * Venue booking → `INSERT INTO Venue_booking`
    374 * Church booking → `INSERT INTO Church_booking`
    375 * Registrar booking → `INSERT INTO Registrar_booking`
    376 * Band booking → `INSERT INTO Band_booking`
    377 * Photographer booking → `INSERT INTO Photographer_booking`
    378 * Availability checks → `SELECT ... WHERE NOT overlapping`
    379 
    380 === Design Notes ===
    381 * Navigation should be consistent across all pages.
    382 * Booking forms must validate date/time availability before submission.
    383 * Required fields should be validated on the client side before SQL execution.
    384 * Lists should support sorting, filtering, and searching.
    385 
    386 == UX/UI Pages Checklist ==
    387 * Login / Registration
    388 * Wedding Dashboard
    389 * Event Management
    390 * Guest List & Attendance
    391 * Bookings (Venue, Church, Registrar, Band, Photographer)
    392 * Service Providers (list/search)
    393 * Reports / Summary
     36 * [wiki:UseCase0003 UC0003] - Create Wedding
     37 * [wiki:UseCase0006 UC0006] - Book Venue
     38 * [wiki:UseCase0009 UC0009] - RSVP for Event
     39 * [wiki:UseCase0011 UC0011] - Assign Attendance / Seating