Mechanic Tools Management is a web application developed with Flask that allows you to manage mechanics, tools, perform daily inventory checks, and generate PDF reports on missing tools.
- Key Features
- Demonstration Video
- How It Works
- Tools and Technologies Used
- Prerequisites
- Installation Instructions
- Insomnia Requests
- Usage Examples
- Observations
- Mechanic and Tool Management: Allows adding, editing, viewing, and deleting mechanics and tools.
- Default Inventory: Assigns a standard set of tools to each mechanic, simplifying inventory management.
- Daily Tool Conference: Records missing tools during daily conferences based on the default inventory.
- PDF Report Generation: Creates daily and aggregate reports on missing tools, as well as inventory checklists per mechanic.
- RESTful API: Provides endpoints for interacting with the application, enabling future integrations or frontend development.
- Data Management:
- Mechanics: Add, edit, view, and delete mechanic information.
- Tools: Manage the available tools catalog, including name and category.
- Default Inventory:
- Assign a standard set of tools to each mechanic, facilitating initial setup and ensuring each mechanic has the necessary tools.
- Daily Conference:
- Conduct daily conferences where mechanics report the tools they have. The application identifies which tools are missing based on the default inventory and records these absences.
- Report Generation:
- Daily Report: Lists the missing tools on a specific date, grouped by mechanic.
- Aggregate Report: Shows the number of missing instances per tool on a specific date.
- Inventory Checklist: Generates a checklist of standard tools grouped by category for each mechanic.
- Flask: A lightweight and flexible web framework for Python application development.
- SQLAlchemy: An ORM (Object-Relational Mapping) tool for efficient database interactions.
- SQLite: A lightweight database used for data storage.
- ReportLab: A library for generating PDF documents.
- Python: A versatile and widely-used programming language.
Before running the application, ensure you have the following prerequisites installed:
- Git: A distributed version control system.
- Python 3.7+ A compatible version of Python.
- Pip: A package manager for installing and managing Python libraries.
- Virtualenv: A tool for creating Python virtual environments.
git clone https://github.com/Eloin-Centro-Automotivo/toolbox-backend.git
cd toolbox-backend
-
pip install virtualenv
-
-
virtualenv venv
-
python -m virtualenv venv
-
-
-
source venv/bin/activate
-
.\venv\Scripts\activate.bat
-
Make sure you have Python and pip installed on your system. Then, install the project dependencies using pip
pip install -r requirements.txt
The application uses SQLite as the database. The database will be created automatically upon the first run of the application. No additional configuration is required.
Start the Flask application with the following command:
python app.py
For greater convenience, an Insomnia file containing all the API requests has been created. This allows you to easily test the endpoints without having to manually configure each request. The file is named insomnia-requests.json
and is located in the root of the project.
To use this file, follow these steps
- Open Insomnia.
- Go to
Application
>Preferences
>Data
tab. - Click on
Import Data
and selectFrom File
. - Choose the
insomnia-requests.json
file from the root of the project. - The requests will be imported and ready to use.
Below are examples of how to use the Mechanic Tools Management API endpoints in different scenarios. These examples can help you understand how to interact with the API effectively. By default, the application will run on localhost:5000
.
-
-
To create a new mechanic, send a
POST
request to the/mechanics
endpoint with the mechanic details in the request body. The request body should be in JSON format as shown below{ "name": "Mechanic Name" }
-
If the mechanic is created successfully, the API will respond with a status code
201 Created
and the details of the newly created mechanic in the response body{ "id": 1, "name": "Mechanic Name" }
-
-
-
To retrieve details of a specific mechanic by its ID, send a
GET
request to the/mechanics/{id}
endpoint, replacing{id}
with the actual mechanic ID. If the mechanic with the specified ID exists, the API will respond with a status code200 OK
and the details of the mechanic in the response body{ "id": 1, "name": "Mechanic Name" }
-
- Database: The application uses SQLite for simplicity. For production environments, consider using more robust databases like PostgreSQL or MySQL.
- Report Generation: Reports are generated in PDF format and stored in memory before being sent as a response. Ensure appropriate permissions if opting to save reports to the file system.
- Future Extensions: The application can be extended with additional features such as user authentication, a more elaborate frontend interface, or integrations with other systems.
- Contributions: Feel free to contribute improvements or report issues through the GitHub repository.