Updated: May 5 2022
Version: v2_0
Prajval Mohan
Thanushri Rajmohan
Hanze Hu
Yusen Zhang
Documentations: http://127.0.0.1:800/v1_0/docs
The preset data file could loaded by running the python file within the server subdirectory:
cd server
python tests/reset.py
The server should be run with uvicorn in the following style:
cd server
uvicorn web:app --reload
The client side program could be run by running the front.py file in the client directory
cd client
python main_front.py
To run server side tests
cd server
python tests/reset.py
pytest
python tests/restore.py
To run frontend tests
cd client
pytest
Update data/data.txt to the datafile currently in use
cd server
python list_transactions.py <data/data.txt>
- The system does not check for the uniqueness of a given user id, in our implementation we have assumed that the ID is unique. Also, we assume that there is going to be no space in names and IDs.
- Although specification did not say we have to authenticate users, we authenticate that users exists on the system before showing the function menu to prevent users from finding out about not being allowed to use certain commands after they have finished inputting all required data.
- Feature: "Users should have associated roles: REGULAR staff or ADMIN" added.
- Feature: "Regular staff should be able to perform all functions in the system except user management" added.
- Feature: "Admins should also be able to add or remove users and change users' roles" added.
- Feature: "Admins should not be able to remove the last admin, either by changing their role or deleting them as a user" added.
- The project's data and documentation is updated to include role information and admin functionality.
- Implemented all requirements from A-01 including all special requirements.
- Implemented persistence mechanism in such a way as to not generate loss of work, change is made to the data file as soon as requests are received on the API endpoints.
- The UI is very user friendly and We limited the number of results demonstrated so as to avoid overwhelming users.
- Besides basic tests to show that our API works, we also test error handling (try/catch) ability of our server.
- No apparent code smell.
- We follow coding style guide totally.
- We streamline the seed data handling by providing reset.py
- The database is resettable.
- We implemented automated tests for all the layers of the system.
- We have used the pytest features of parametrize.
- All new features should be implemented in a seperate feature branch
- All commits should have a clear, relevant description of what was implemented in that commit
- Once a feature has been completed, and there's no remaining conflict, the branch should be merged onto dev by the author of the branch
The MPCS Inc. Reservation System starts off by printing a welcome message and asking the user to run the terminal on full screen. This is because, sometimes, if the enteries are long, the displays might run into multiple lines and make the output look confusing.
First, the user is asked to enter his/her staff ID. This input is authenticated by checking if it has spaces or if the ID entered is invalid. If an issue is detected, an error message will pop up.
If the Staff ID entered is correct, the user session begins and the Main Menu of the reservation system pops up. The main menu has the following options:
- Make a reservation
- Make a recurring reservation
- Cancel a reservation
- Generate report of the current reservations over a particular time period
- Get financial transactions over a particular time period
- Manage staff
- Logout
Now, the user is prompted to enter his/her choice.
... He/she wants to make a reservation. Both the admin and the regular user can make a reservation. The user will be prompted with the reservation menu, which is displayed as follows:
Equipment in facility:
- Press W for workshop
- Press M for mini microvacs
- Press I for irradiators
- Press P for polymer extruders
- Press C for high velocity crusher
- Press H for 1.21 gigawatt lightning harvester
- Press E for exit
Here, the user is asked to pick the device and input his/her details for the device he/she wants to reserve.
The reservations of every device (from 1-6) is in accordance to the "E-requirement" of A-01, and follows all the regular and special constraints.
If the user clicked "E" he is redirected to the Main Menu.
... He/she wants to make a recurring reservation. Both the admin and the regular user can make a recurrig reservation. The user will be prompted with the reservation menu, which is displayed as follows:
Equipment in facility:
- Press W for workshop
- Press M for mini microvacs
- Press I for irradiators
- Press P for polymer extruders
- Press C for high velocity crusher
- Press H for 1.21 gigawatt lightning harvester
- Press E for exit
Here, the user is asked to pick the device and input his/her details for the device he/she wants to reserve.
The reservations of every device (from 1-6) is in accordance to the "E-requirement" of A-01, and follows all the regular and special constraints.
If the user clicked "E" he is redirected to the Main Menu.
... He/she wants to cancel a pre-existing reservation. Both the admin and the regular user can cancel a reservation.
The user is asked to enter the transaction ID he/she wants to cancel, which is cancelled after confirmation.
... He/she wants to get the current reservations for a given date range. Both the admin and the regular user can access them.
Here, if the you enter a "user ID" you get the current reservations of that particular user in the entered date range, else, you get all reservations in that given date range.
... He/she wants to get the financial transactions over a given date range. Both the admin and the regular user can access them.
... He/she wants to manage the staff. Only Admins can successfully make these changes. When this option is selected, the user is presented with the following menu:
Select task you want to perform:
- Press A for adding staff
- Press D for deleting staff
- Press U for updating staff
- Press E for exit
The user is now asked to pick an option.
If the user picks A he/she wants to add a staff member. He/she will be asked for the following inputs - Staff ID to be added and Staff Role (optional: by default REGULAR). If the user performing the task is an Admin, he/she will be able to complete the action, else, he/she will be presented with an error message stating that he/she needs to be an Admin in order to complete this action. Other issues that might cause this action to fail are if the staff ID already exists or if the input is invalid.
If the user picks D, he/she wants to delete a staff member. He/she will be asked to input the ID of the staff he/she wants to delete. If the user performing the task is an Admin, he/she will be able to complete the action, else, he/she will be presented with an error message stating that he/she needs to be an Admin in order to complete this action. Another issue that might cause this action to fail is if the Staff ID to be deleted does not exist.
If the user picks U, he/she wants to update a staff member. He/she will be asked for the following inputs - ID of the staff to be modified and role the staff is to be modified to. If the user performing the task is an Admin, he/she will be able to complete the action, else, he/she will be presented with an error message stating that he/she needs to be an Admin in order to complete this action. Another issue that might cause this action to fail is if the Staff ID to be modified does not exist or if the input given in is invalid.
If the user picks E, he/she wants to exit from this action. When this option is selected, the user is redirected to the Main Menu.
... He/she wants to loggout of the current user session. If the user logs out, he/she is asked if he/she wants to login with a different Staff ID. If the user enters No, the system shuts off, else, the entire process repeats.
- Backend contains two parts: the reserve system and the user management system. And we seperate these two parts.
- The reserve system has a typical layered structure. It contains three layers, namely web layer (web.py), business logic layer (reserve.py), and persistence layer (persist.py). The web layer only depends on the business logic layer, and the business logic layer only depends on the persistence layer.
- The user management system also has the same layers. The web layer is implemented in web.py and user_management_models.py. The business logic layer is in user_management.py and The persistence layer is in user_management_persist.py.
- The pathes of files storing reserve sytem data and users are specified in config.json. We can redirect output and input to other files by changing config.json.
- Our approach of IO operations: the system does IO operations for each request independently. Specifically, for each request, the system will load data file into memory, read/write in-memory data structures, and then save all data to disk. Another possible approach: load data into memory when the first request comes, read/write in-memory data structures for subsequent requests, and save data to disk after the last request is handled. Our approach may be less efficient but is more robust. And the performace issue will be solved once we migrate to real database.
For any questions please contact:
Prajval Mohan
prajval.mohan23@gmail.com