This project is part the first-year "Fundamentals" curriculum at Holberton School.
We were asked to imagine, design and develop a web application of our choice in three months.
This README describes the different stages of my work on this portfolio project, from technical documentation to code.
This project is currently in the technical documentation stage.
It provide an overview with of the project with :
- Users stories
- Mockups
- Architecture design and technology stack
- Entities relantionship diagram
- Classes diagram
- Sequences diagrams
- API Documentation
- SCM and QA strategy plan
Few things might need refinement later :
- Dynamic mock ups could be done instead of static ones
- API : somes routes might need to be refactored as some resources are more sub-resources
- API : use PATCH method for soft delete instead of DELETE method
- Diagrams : create better diagram, more readable
This application offers an open-source solution for cultural organisations to manage their reservations.
Cultural organisations such as local museums and associations need sometimes some open-source or free-to-use solutions for economic reasons : they use several tools to manage their reservations, analyze their audiences, generate invoices...
This application aims to bring together three main features :
- reservation scheduling,
- automatic document generation based on scheduling information (contracts, invoices...),
- data extraction for reporting purpose,
Show users stories
This section presents users stories so that we can imagine the app and define requirements from a user perspective : what they aime to achieve and what are their needs will guide the application designing later.-
create a reservationso that I can manage my activityMust have -
register client's contactinformation so that I can keep in contact with them all along the reservation process.Must have -
register the activity information(theme, price, audience) requested by the client, so that I can prepare the activity (animation, exhibition visit, etc.).Must have -
use reservation information to
generate an agreement, so that I can formalize the reservation.Should have -
use reservation information to
generate a recapfor the client, so that the client and I have the same information of the reservation.Should have -
use reservation information to
generate an invoice, so that I can be paid by the client after the service has been delivered.Should have -
track the reservation status, so that I can know which work still needs to be done.Could have -
extract my reservationsin a csv file so that I can analyze my audiences and my general activity.
Should have
-
view every reservationof all users so I can have an overview of the activity.
Should have -
be able to
extract all the reservationsso I can produce an activity report for the organisation.
Should have -
access every reservation : creation and updateso I can take action in case a collaborator is unavailable.
Should have
Show Mockups section
On the basis of users stories, this section provide three mock ups illustrating the user journey on the application.A sober style is intentionally chosen to make the application easy to use.
A simple screen where users use their mail and password to authenticate.
After login, users land on this page.
They can see essential reservation details for each days, and click on a reservation they want more details on.
UI evolutions :
- First card should be a monday and last card a sunday
- May be a row for each day will be prefered if it is too hard to display by cards
- The name of the day should be displayed
- Some filters could sort reservations by status or reservation types.
On this screen, users can create a reservation.
The type of structure is decided first, and then the ZIP code. Finally, the user have to check if the structure making the reservation already exists in the database in the 'Nom de la structure' drop-down box, or else, create it.
When a structure is selected, adress, phone and email fields are automatically filled.
UI Evolution :
- An icone to create structures should be displayed
Show architecture and technology section
This application follow a monolithic application three-tiers logic client-server architecture :
- presentation layer : a
front-endinterface allowing users to log in and create, update and view reservations; - business logic : a
back-endexposing a RESTful API that receive user queries from the front-end and apply business rules; - data and persistence layer : a
relational databaseused to store reservations, structures, reservation types, users, etc.;
-
Front-end :
HTML5, CSS3, JavaScript
Interface is built withHTML5,CSS3andJavaScriptfor interactivity andclient-side rendering.
Users access to data via HTTP requests through a RESTful API. -
Back-end :
Facade pattern, python, Flask RESTX API, ORM SQLAlchemy
Back-end is responsible forbusiness logic.
It exposes aRESTful APIthat receives user requests and returns data.
AFacade patternis used to process requests : it orchestrates object creation and data storage making the code easier to maintain and update.
SQLAlchemywill allow to manipulate data as objects, making requests safer and to focus on object-oriented paradigm. -
Database :
MySQL
Entities have strong relationships, that is why an SQL database is chosen.
SQLAlchemy ORMis used by the back end to define models, manage database schema and perform queries.
Since there is no need of extensibility, specific data types and no advanced features,MySQLis well suited for the project's requirements : easy to maintain, open-source, well documented, and well known by the developer team.
Show entities relationship section
Based on user needs identified in the user stories, this section present the entities, relationships and explains key design choices of the model.
Since storing data on reservations is a the core of the application, the ER diagram was designed first.
This diagram picture the general structure of the database tables and, attribute types, primary and foreign keys and relationships.
Access to full view
Access to Mermaid code
The reservation entity is central in the ER diagram and almost all its attributes are related to other entities.
In order to understand the relationships between reservation and other entities, some clarifications might be needed on modeling decisions.
The following points explain specific modeling decisions :
Attributes
-
users role
User can be a manager or not.
A manager have access to specific CRUD operations (see Internal API Documentation). -
reservation attributes "contact"
Is not the structure contact but the contact of the specific person, from the structure, in charge of the reservation.
Sometimes, the contact from the structure is not the same person from a reservation to another.
Then, the contact is specific to the reservation.
Relationships
-
relationship users/reservation_types
User can't create any type of reservation.
A list of reservation_types tels which type of reservation a user can manipulate.
Someone in charge of animation can't create reservation for an exhibition rental. -
relationship themes/reservation_types
Each kind of reservation_types have a specific list of themes.
Entities
-
reservation_types
Are referring to the kind of activity booked : exhibition visit, outdoor animation, etc. -
audiences_types, themes, reservation_types, structures_types
Are needed to keep data consistency and integrity.
Types can be useful for reports. Having types entities avoids having the same value written in different ways.
Let's take a look at relationships with reservation entity.
| Table | Relationship with reservation | Commentary |
|---|---|---|
| USERS | 1-N | A reservation is authored by one user A user can author zero or many reservations |
| STRUCTURES | 1-N | A reservation has one structure A structure can do many reservations |
| RESERVATION_TYPES | 1-N | The structure must book one activity An activity can be booked many times |
| THEMES | N-N | A structure can book many themes A theme can be booked many times |
| AUDIENCES | 1-N | A reservation have several audiences ; and audience is a school level and a count of school children An audience is unique to a reservation. |
| STATUS | 1-N | A reservation got only one status, indicating at which step the reservation is Many reservation use the same statuses. |
Show Class diagram section
This section presents the classes and methods of our business logic layer.\ The use of SQLAchemy ORM helped to transform tables (except join tables) from ER diagram into classes.Base class
The base class is an abstract class that all objects inherit from. It give them an auto-generated UUID and a creation date (timestamp).
In addition, a boolean attribute "is_active" is *defined, since data deletion won't be authorized to keep integrity and historical consistency to our database.
Facade class
Using the facade pattern, a facade class will provide methods for object manipulation : creation, storage, update, etc.
This provide better maintainability of the codebase.
Repository class
Ultimately, several repository classes will be implemented, inheriting from an abstract Repository class that defines core methods for objects.
Child repository classes might define specific methods once SQAlchemy is implemented, allowing fine grained request by specific attributes.
Show sequences diagram section
hree high-level sequence diagrams illustrate the communication between each layer detailed in the previous section.
Login
Access Mermaid JS code
Users send credentials to the API. An access token is generated if authentication succeeds, otherwise, an error message is returned.
Reservations view / Landing page loading
After the user logs in, the landing page is loaded and fetches the API to retrieve reservations for the current month.
The token identity is checked and only the reservations a user has authored are displayed.
If the user is a manager, every reservation for the current month are displayed.
Reservation creation
Access Mermaid JS code
When a user creates a reservation, the token identity is checked to determine if he has required authorizations to create a reservation for the selected reservation type.
Data input is validated and if everything is correct, the resource is created.
Show API Documentation section
This section explain the application API rules, the routes and methods allowed, the status codes and the input and output formats for the main classes.- POST
Allows resource creation, a data input is required; - GET
Allows resource retrieval.
A specific resource can be retrieved if route allowpath parameter- otherwise, all resources are retrieved; - PUT
Allows resource update ; a data input is required andpath parameteris necessary to specify which resource to update; - DELETE
Delete methods are not allowedto keep data integrity and historical consistency.
Instead, resources will be marked asinactive;
Users can create reservations and themes in reservation types they are allowed to.
They can create, update and retrieve structures.
They can access reservations they authored.
They can create and modify audiences to their reservations.
Manager can access all resources.
They are the only ones that can perform types (reservation, audience, structure) and status creation and update.
Some routes might need to be refactored, as certain resources can be better represented as sub-resources.
| Route | Methods allowed | Path parameter | Authorizations | Action |
|---|---|---|---|---|
/login |
POST | / | - No authorizations needed | Gives access token to user if authentication success |
/user |
POST PUT GET |
user_id | - Manager role required | User(s) management |
/reservations |
POST PUT GET |
reservation_id | - Reservation type authorization required -Author authorization - Manager role |
Manage reservations |
/reservation_types |
POST PUT GET |
type_id | - Manager role for POST and PUT - Authentication for GET |
Manager reservation types |
/structures |
POST PUT GET |
structure_id |
- Authentication needed | Manage structres |
/structure_types |
POST PUT GET |
structure_id | - Manager role for POST and PUT - Authentication for GET |
Manage structure types |
/themes |
POST PUT GET |
theme_id | - Reservation type authorization - Manager role |
Manage themes |
/audience |
POST PUT GET |
reservation_id ? | - Reservation's author authorization - Manager role |
Manage audiences |
/audience_types |
POST PUT GET |
type_id | - Manager role for POST and PUT - Authentication for GET |
Manage audience types |
Input and output data is in JSON format.
To perform POST and PUT request, you can refer to the attribute shown in the class diagram.
| Status code | Message | Meaning |
|---|---|---|
| 200 | OK | Resource successfully retrievedGET method |
| 201 | Created | Resource successfully createdPOST method |
| 400 | Invalid input | Some data in the input are not in the expected formatPOST method |
| 401 | Invalid credentials | Wrong credentials registered while logging inPOST method on login route |
| 403 | Unauthorized action | User tried to access a route he is not allowed to |
| 404 | Resource not found | User tried to access a specific resource, but it can't be foundPUT methodGET method |
Show SCM and QA plan section
This section details the modus operandi for versioning strategy and testing.SCM strategy
Git will be use for code version control.
GitHub will be used as a remote repository, making sure the latest version of code is available on the cloud.
Three branches will be used :
- Production branch
This branch will contain stable and tested code, ensuring that a working version is always available. - Development branch
This branch will be used to develop new features without breaking the production version. - Test branch
This branch will be used to test the code from development branch before merging it into the production branch.
Commit and merging strategy
A commit is made in development branch whenever a feature is developed and seems functional.
A verb will explain what action has been done : "added new function for...", "fixed return and status code", "configured database", etc.
Merges occurs in the following order :
dev branch --> test branch -- if success --> production branch -- new feature --> dev branch
dev branch --> test branch -- if fails --> dev branch
QA strategy
Several tests will be performed according to the stage of development before any merge into the production branch.
- Object creation :
Unit tests will check if objects are well created with the expected attribute values.
Tests should verify that expected errors are thrown in case of wrong data type for exemple. - API methods and response :
Postman will be used to test routes and methods.
IDs and tokens will be stored in environment variables.
Some failing tests will be implemented to verify expected status codes and response messages. - SQLAlchemy ORM :
When the project has transitioned from in memory repository to database repository, tests from Postman should still be functional and should give the same results.






