| | 1 | = UC0003 Prototype Implementation - Approve or Reject Reservations = |
| | 2 | |
| | 3 | '''Initiating actor:''' Faculty Administrator |
| | 4 | |
| | 5 | '''Other actors:''' Teaching Staff, Student (the requesters) |
| | 6 | |
| | 7 | 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. |
| | 8 | |
| | 9 | == Scenario == |
| | 10 | |
| | 11 | 1. The administrator selects ''Approve or Reject Reservations'' from the main menu. The system queries all pending reservations: |
| | 12 | {{{ |
| | 13 | SELECT res.reservation_id, res.start_time, res.end_time, |
| | 14 | res.purpose, res.created_at, res.recurrence_group_id, res.resource_id, |
| | 15 | u.first_name || ' ' || u.last_name AS requested_by, |
| | 16 | ut.type_name AS requester_role, |
| | 17 | r.name AS resource_name, l.building, l.room |
| | 18 | FROM reservations res |
| | 19 | JOIN users u ON res.user_id = u.user_id |
| | 20 | JOIN user_types ut ON u.type_id = ut.type_id |
| | 21 | JOIN resources r ON res.resource_id = r.resource_id |
| | 22 | JOIN resource_types rt ON r.type_id = rt.type_id |
| | 23 | LEFT JOIN locations l ON r.location_id = l.location_id |
| | 24 | WHERE res.status = 'pending' |
| | 25 | ORDER BY res.created_at ASC; |
| | 26 | }}} |
| | 27 | |
| | 28 | The system displays the pending reservations as a numbered list: |
| | 29 | {{{ |
| | 30 | === Pending Reservations (4) === |
| | 31 | |
| | 32 | 1. [#4] Database Systems Lecture - Week 4 |
| | 33 | by Elena Stojanova (Teaching Staff) |
| | 34 | Lecture Hall 201 (FINKI-A / 201) |
| | 35 | 2026-02-24 09:00 - 2026-02-24 11:00 |
| | 36 | 2. [#10] Thesis writing session |
| | 37 | by David Angelovski (Student) |
| | 38 | ... |
| | 39 | }}} |
| | 40 | |
| | 41 | 2. The administrator selects reservation #4 to review. The system shows full details and detects it is part of a recurring series. |
| | 42 | {{{ |
| | 43 | SELECT reservation_id, start_time, end_time, status |
| | 44 | FROM reservations |
| | 45 | WHERE recurrence_group_id = 'a1b2c3d4-e5f6-4789-abcd-ef0123456789' |
| | 46 | ORDER BY start_time; |
| | 47 | }}} |
| | 48 | |
| | 49 | 3. The system checks for conflicts with approved reservations on the same resource and time. |
| | 50 | {{{ |
| | 51 | SELECT res2.reservation_id, res2.start_time, res2.end_time, |
| | 52 | res2.purpose |
| | 53 | FROM reservations res2 |
| | 54 | WHERE res2.resource_id = 3 |
| | 55 | AND res2.reservation_id != 4 |
| | 56 | AND res2.status = 'approved' |
| | 57 | AND res2.start_time < '2026-02-24 11:00:00' |
| | 58 | AND res2.end_time > '2026-02-24 09:00:00'; |
| | 59 | }}} |
| | 60 | |
| | 61 | 4. No conflicts found. The administrator approves the reservation. The system updates the status: |
| | 62 | {{{ |
| | 63 | UPDATE reservations |
| | 64 | SET status = 'approved', approved_by = 1 |
| | 65 | WHERE reservation_id = 4 AND status = 'pending' |
| | 66 | RETURNING reservation_id, status; |
| | 67 | }}} |
| | 68 | |
| | 69 | The system confirms the action: |
| | 70 | {{{ |
| | 71 | Reservation #4 has been approved. |
| | 72 | }}} |