Changes between Initial Version and Version 1 of UseCase0003


Ignore:
Timestamp:
03/16/26 20:42:47 (5 days ago)
Author:
221511
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase0003

    v1 v1  
     1= UC0003: Approve or Reject Reservations =
     2
     3'''Initiating actor:''' Faculty Administrator
     4
     5'''Other actors:''' Teaching Staff, Student (the users who made the pending reservations)
     6
     7A faculty administrator reviews pending reservation requests. The system presents a list of all pending reservations with the requester's details and the resource information. The administrator can approve or reject each request, which updates the reservation status and records who made the decision.
     8
     9== Scenario ==
     10
     11 1. The administrator (Ana Petrovska, user_id = 1) opens the pending reservations dashboard. The system retrieves and displays all pending reservations with requester and resource details.
     12{{{
     13SELECT res.reservation_id, res.start_time, res.end_time,
     14       res.purpose, res.created_at,
     15       u.first_name || ' ' || u.last_name AS requested_by,
     16       u.email AS requester_email,
     17       ut.type_name AS requester_role,
     18       r.name AS resource_name,
     19       rt.type_name AS resource_type,
     20       l.building, l.room
     21FROM project.reservations res
     22JOIN project.users u ON res.user_id = u.user_id
     23JOIN project.user_types ut ON u.type_id = ut.type_id
     24JOIN project.resources r ON res.resource_id = r.resource_id
     25JOIN project.resource_types rt ON r.type_id = rt.type_id
     26LEFT JOIN project.locations l ON r.location_id = l.location_id
     27WHERE res.status = 'pending'
     28ORDER BY res.created_at ASC;
     29}}}
     30
     31 2. The administrator reviews the list of pending reservations. The system shows 4 pending items.
     32
     33 3. The administrator selects reservation_id = 4 (''Database Systems Lecture - Week 4'' by Elena Stojanova for Lecture Hall 201) to review in detail. The system shows the full reservation details.
     34{{{
     35SELECT res.reservation_id, res.start_time, res.end_time,
     36       res.status, res.purpose, res.created_at,
     37       res.recurrence_group_id,
     38       u.first_name || ' ' || u.last_name AS requested_by,
     39       u.email,
     40       r.name AS resource_name, r.description AS resource_description,
     41       r.available_from, r.available_to,
     42       l.building, l.room
     43FROM project.reservations res
     44JOIN project.users u ON res.user_id = u.user_id
     45JOIN project.resources r ON res.resource_id = r.resource_id
     46LEFT JOIN project.locations l ON r.location_id = l.location_id
     47WHERE res.reservation_id = 4;
     48}}}
     49
     50 3a. The system detects that this reservation belongs to a recurring series (recurrence_group_id is not NULL) and displays all reservations in the same series for context.
     51{{{
     52SELECT res.reservation_id, res.start_time, res.end_time, res.status
     53FROM project.reservations res
     54WHERE res.recurrence_group_id = 'a1b2c3d4-e5f6-4789-abcd-ef0123456789'
     55ORDER BY res.start_time;
     56}}}
     57
     58 4. The system checks for scheduling conflicts with other approved reservations on the same resource and time.
     59{{{
     60SELECT res.reservation_id, res.start_time, res.end_time,
     61       res.purpose,
     62       u.first_name || ' ' || u.last_name AS reserved_by
     63FROM project.reservations res
     64JOIN project.users u ON res.user_id = u.user_id
     65WHERE res.resource_id = 3
     66  AND res.reservation_id != 4
     67  AND res.status = 'approved'
     68  AND res.start_time < '2026-02-24 11:00:00'
     69  AND res.end_time > '2026-02-24 09:00:00';
     70}}}
     71
     72 5. No conflicts are found. The administrator clicks ''Approve''. The system updates the reservation status and records who approved it.
     73{{{
     74UPDATE project.reservations
     75SET status = 'approved',
     76    approved_by = 1
     77WHERE reservation_id = 4
     78  AND status = 'pending'
     79RETURNING reservation_id, status, approved_by;
     80}}}
     81
     82 6. The administrator then selects reservation_id = 16 (''3D print parts for robotics competition'' by Filip Ristovski for Ultimaker S3) and decides to reject it. The system updates the reservation status.
     83{{{
     84UPDATE project.reservations
     85SET status = 'rejected',
     86    approved_by = 1
     87WHERE reservation_id = 16
     88  AND status = 'pending'
     89RETURNING reservation_id, status, approved_by;
     90}}}
     91
     92 7. The system confirms both actions and displays the updated reservation statuses.
     93{{{
     94SELECT res.reservation_id, res.status, res.purpose,
     95       u.first_name || ' ' || u.last_name AS approved_by_name
     96FROM project.reservations res
     97LEFT JOIN project.users u ON res.approved_by = u.user_id
     98WHERE res.reservation_id IN (4, 16);
     99}}}