wiki:UseCase0002PrototypeImplementation

UC0002 Prototype Implementation - Make a Resource Reservation

Initiating actor: Teaching Staff

Other actors: Faculty Administrator (receives pending reservation for approval)

A teaching staff member selects a resource from a list, enters the desired date, time, and purpose. The system validates the availability window, checks for scheduling conflicts, and if the slot is free, creates a new reservation with status pending.

Scenario

  1. The user selects Make a Resource Reservation from the main menu. The system displays all resources as a numbered list. The user selects Classroom 101.
    SELECT r.resource_id, r.name, r.description,
           r.available_from, r.available_to, r.available_weekends,
           rt.type_name, l.building, l.room
    FROM resources r
    JOIN resource_types rt ON r.type_id = rt.type_id
    LEFT JOIN locations l ON r.location_id = l.location_id
    ORDER BY rt.type_name, r.name;
    
  1. The system shows the resource details and existing reservations for the next 7 days.
    SELECT res.start_time, res.end_time, res.status, res.purpose,
           u.first_name || ' ' || u.last_name AS reserved_by
    FROM reservations res
    JOIN users u ON res.user_id = u.user_id
    WHERE res.resource_id = 1
      AND res.status IN ('approved', 'pending')
      AND res.start_time >= CURRENT_DATE AND res.start_time < CURRENT_DATE + 7
    ORDER BY res.start_time;
    
  1. The user enters the reservation details: date 2026-02-13, time 10:00 to 12:00, purpose Operating Systems Lecture.
  1. The system validates the availability window.
      Reservation date (YYYY-MM-DD): 2026-02-13
      Start time (HH:MM): 10:00
      End time (HH:MM): 12:00
      Purpose: Operating Systems Lecture
    
  1. The system checks for conflicting reservations and finds none.
    SELECT res.reservation_id, res.start_time, res.end_time,
           res.purpose,
           u.first_name || ' ' || u.last_name AS reserved_by
    FROM reservations res
    JOIN users u ON res.user_id = u.user_id
    WHERE res.resource_id = 1
      AND res.status IN ('approved', 'pending')
      AND res.start_time < '2026-02-13 12:00:00'
      AND res.end_time > '2026-02-13 10:00:00';
    
  1. The user confirms the reservation. The system inserts the new reservation with status pending:
    INSERT INTO reservations
        (start_time, end_time, status, purpose, created_at, user_id, resource_id)
    VALUES ('2026-02-13 10:00:00', '2026-02-13 12:00:00', 'pending',
            'Operating Systems Lecture', CURRENT_TIMESTAMP, 3, 1)
    RETURNING reservation_id, status, created_at;
    

The system confirms the reservation was created:

  Reservation created successfully!
  Reservation ID: 34
  Status: pending (awaiting administrator approval)

Alternative: Conflict Detected

5a. If the user had requested 2026-02-06 from 09:00 to 11:00, the conflict check would find an overlapping reservation. The system displays the conflicts and offers to try a different time.

  CONFLICT: 1 overlapping reservation(s) found:
  ID | Start            | End              | Purpose                    | Reserved by
  ---+------------------+------------------+----------------------------+------------------
  24 | 2026-02-06 08:00 | 2026-02-06 10:00 | Morning lecture - Operatin | Elena Stojanova

  Try a different time? (y/n):
Last modified 5 days ago Last modified on 03/16/26 21:53:51
Note: See TracWiki for help on using the wiki.