This commit branch has been muddled with changes that are out of scope
and cover more than just the models. Specifically it includes
completion of basic guest related models, database access, command line interface
integration and preventing SQL injection.
Total summary of changes:
**IMPORTANT CHANGE: All queries are now parameterized to prevent SQL
injections. Prior versions are subject to it since the strings were
built.
- HotelManager
This class is used to provide database operations that are outside of
scope from a given model. Furthermore if there is no model to work off
of, such as creating a new model based off an existing entry, these
functions live outside of the model since it makes no sense for models
to contain functions where it would retrieve itself with no context.
Realistically this could be placed in an empty constructor and address
itself, however, for now this functionality has been moved off the model
since it is a one use and is not guaranteed to generate a guest. Some
functionality for the coming employee management functions are already
in there since they share overlap with the guest module. Specifically
GetBaseRate for checking and getting the base rate.
- DatabaseManager
This class has mostly migrated functionality out or switch to
parameterized query generation to prevent SQL injections.
- Guest, Reservation, and Transaction Classes
Migrated functionality to create the database entry and a new entry of
guest upon creation as well as update them.
- Program (Terminal app)
Fully integrated the guest module. Has not undergone extensive testing
but does work as of this commit.
The HotelManager class now has been connected to some aspects of the
command line interface and is functioning for a few cases such as
logging in as a specific guest via email, chaging a guests information
and creating a new guest account. This was implemented first over the
reservation system to test and implement something on a smaller scale.
Furthermore, the reservation depends on an existing guest account since
a Guest ID needs to be linked to the reservation that is created.
Other changes include redesigning, tweaking/ adjusting, and/ or fixing
of other modules that have not yet been implemented or are partially
implemented.
This is another commit to mostly version the code. There have been a
considerable number of changes and there is functionality that I am
still determining whether it should lie within the manager or the model
class itself. It makes the most sense to possibly add the "Update" or
database manipulation functions on the models themselves. On the other
hand, instead of creating and generating the ID in the model, the
current design is to create the entry in the database first, get the
last insert row ID and create a new and complete model that is returned
back by the function. This allows us to leverage the autoincrement
functionality of the database rather than trying to design a function
and/ or make an additional call to the database.
**NOTE: Code is non-functional due to some classes not having their
errors resolved.