wiki:UseCase0003PrototypeImplementation

Version 1 (modified by 221511, 5 days ago) ( diff )

--

UC0003 Prototype Implementation - Approve or Reject Reservations

Initiating actor: Faculty Administrator

Other actors: Teaching Staff, Student (the requesters)

The administrator views a list of all pending reservations, selects one to review in detail (including conflict analysis and recurrence information), and approves or rejects it.

Scenario

  1. The administrator selects Approve or Reject Reservations from the main menu. The system queries all pending reservations:
    SELECT res.reservation_id, res.start_time, res.end_time,
           res.purpose, res.created_at, res.recurrence_group_id, res.resource_id,
           u.first_name || ' ' || u.last_name AS requested_by,
           ut.type_name AS requester_role,
           r.name AS resource_name, l.building, l.room
    FROM reservations res
    JOIN users u ON res.user_id = u.user_id
    JOIN user_types ut ON u.type_id = ut.type_id
    JOIN resources r ON res.resource_id = r.resource_id
    JOIN resource_types rt ON r.type_id = rt.type_id
    LEFT JOIN locations l ON r.location_id = l.location_id
    WHERE res.status = 'pending'
    ORDER BY res.created_at ASC;
    

The system displays the pending reservations as a numbered list:

=== Pending Reservations (4) ===

  1. [#4] Database Systems Lecture - Week 4
       by Elena Stojanova (Teaching Staff)
       Lecture Hall 201 (FINKI-A / 201)
       2026-02-24 09:00 - 2026-02-24 11:00
  2. [#10] Thesis writing session
       by David Angelovski (Student)
       ...
  1. The administrator selects reservation #4 to review. The system shows full details and detects it is part of a recurring series.
    SELECT reservation_id, start_time, end_time, status
    FROM reservations
    WHERE recurrence_group_id = 'a1b2c3d4-e5f6-4789-abcd-ef0123456789'
    ORDER BY start_time;
    
  1. The system checks for conflicts with approved reservations on the same resource and time.
    SELECT res2.reservation_id, res2.start_time, res2.end_time,
           res2.purpose
    FROM reservations res2
    WHERE res2.resource_id = 3
      AND res2.reservation_id != 4
      AND res2.status = 'approved'
      AND res2.start_time < '2026-02-24 11:00:00'
      AND res2.end_time > '2026-02-24 09:00:00';
    
  1. No conflicts found. The administrator approves the reservation. The system updates the status:
    UPDATE reservations
    SET status = 'approved', approved_by = 1
    WHERE reservation_id = 4 AND status = 'pending'
    RETURNING reservation_id, status;
    

The system confirms the action:

  Reservation #4 has been approved.
Note: See TracWiki for help on using the wiki.