Changes between Initial Version and Version 1 of UseCase0003PrototypeImplementation


Ignore:
Timestamp:
06/18/26 23:53:12 (2 days ago)
Author:
223091
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase0003PrototypeImplementation

    v1 v1  
     1= Use-case 0003 Implementation - Approve or reject reservation =
     2
     3== Initiating actor ==
     4
     5Reservation Approver
     6
     7== Other actors ==
     8
     9Room Requester
     10
     11== Description of the use-case goals ==
     12
     13The goal of this use-case is to allow a reservation approver to review pending reservation requests and record an approval or rejection decision. The system displays pending reservations, allows the approver to select a reservation, and then saves the decision in the database.
     14
     15This use-case demonstrates update and insert operations in the database. The reservation status is updated, and a new approval record is inserted.
     16
     17== Scenario ==
     18
     19The Reservation Approver chooses the option ''Approve or reject reservation'' from the main menu.
     20The system displays a list of all pending reservations.
     21The Reservation Approver selects a reservation from the list.
     22The system displays a list of users who can approve reservations.
     23The Reservation Approver selects the approver from the list.
     24The system asks whether the reservation should be approved or rejected.
     25The Reservation Approver chooses the decision.
     26The system asks for an optional decision note.
     27The Reservation Approver enters a note.
     28The system updates the status of the selected reservation in the ''project.reservations'' table.
     29The system inserts a new approval record into the ''project.approvals'' table.
     30The system displays the final reservation details, including status, decision, decision time, and approver.
     31
     32== Screenshots ==
     33
     34The following screenshot shows the list of pending reservations and the approval input.
     35
     36[[Image(uc0003_pending_reservations.png, width=100%)]]
     37
     38The following screenshot shows the final approved reservation details.
     39
     40[[Image(uc0003_reservation_approved.png, width=100%)]]
     41
     42The following screenshot shows database verification in DBeaver for the approval record.
     43
     44[[Image(dbeaver_approvals_result.png, width=100%)]]
     45
     46== SQL commands used by the system ==
     47
     48The system first lists all pending reservations.
     49
     50{{{
     51SELECT
     52res.reservation_id,
     53res.reservation_date,
     54res.start_time,
     55res.end_time,
     56res.status,
     57u.full_name AS requester_name,
     58r.room_code,
     59e.name AS requested_equipment,
     60req.requested_quantity
     61FROM project.reservations res
     62JOIN project.users u
     63ON u.user_id = res.user_id
     64LEFT JOIN project.rooms r
     65ON r.room_id = res.room_id
     66LEFT JOIN project.reservation_equipment req
     67ON req.reservation_id = res.reservation_id
     68LEFT JOIN project.equipment e
     69ON e.equipment_id = req.equipment_id
     70WHERE res.status = 'pending'
     71ORDER BY res.reservation_date, res.start_time, res.reservation_id;
     72}}}
     73
     74The system then lists the possible approvers.
     75
     76{{{
     77SELECT
     78user_id,
     79full_name,
     80username,
     81role
     82FROM project.users
     83WHERE role IN ('approver', 'admin')
     84ORDER BY user_id;
     85}}}
     86
     87After the approver selects the reservation and the decision, the system updates the reservation status.
     88
     89{{{
     90UPDATE project.reservations
     91SET status = ?
     92WHERE reservation_id = ?
     93AND status = 'pending';
     94}}}
     95
     96The system then inserts the approval decision.
     97
     98{{{
     99INSERT INTO project.approvals (
     100reservation_id,
     101approver_id,
     102decision,
     103decision_time,
     104note
     105)
     106VALUES (?, ?, ?, CURRENT_TIMESTAMP, ?);
     107}}}
     108
     109Finally, the system displays the final reservation details.
     110
     111{{{
     112SELECT
     113res.reservation_id,
     114res.reservation_date,
     115res.start_time,
     116res.end_time,
     117res.status,
     118u.full_name AS requester_name,
     119r.room_code,
     120a.decision,
     121a.decision_time,
     122a.note,
     123approver.full_name AS approver_name
     124FROM project.reservations res
     125JOIN project.users u
     126ON u.user_id = res.user_id
     127LEFT JOIN project.rooms r
     128ON r.room_id = res.room_id
     129LEFT JOIN project.approvals a
     130ON a.reservation_id = res.reservation_id
     131LEFT JOIN project.users approver
     132ON approver.user_id = a.approver_id
     133WHERE res.reservation_id = ?;
     134}}}
     135
     136== Database usage explanation ==
     137
     138This use-case reads data from the following tables:
     139
     140''project.reservations'' – to list pending reservations and display the final reservation status.
     141''project.users'' – to display the requester and the approver.
     142''project.rooms'' – to display room information.
     143''project.reservation_equipment'' – to display requested equipment if it exists.
     144''project.equipment'' – to display equipment names.
     145''project.approvals'' – to display and store the approval decision.
     146
     147This use-case modifies the database by:
     148
     149updating the status of the selected reservation in ''project.reservations'';
     150inserting a new approval decision in ''project.approvals''.
     151
     152== Result of the implementation ==
     153
     154The prototype successfully approved reservation ID 9. The reservation status was changed to ''approved'', and a corresponding approval record was inserted into the ''project.approvals'' table. The approval record contains the approver, decision, decision time, and decision note.