PyCoffee is a Flask-based application designed to manage a coffee shop's operations, including order processing, inventory management, and user authentication.
PyCoffee is a web application that helps manage a coffee shop. It provides features such as order creation, inventory tracking, and user authentication (including roles for admin and client).
- Python 3.7+
- Flask
- Clone the repository:
git clone https://github.com/CaueGrassi7/PyCoffee.git
- Navigate to the project directory:
cd PyCoffee
- Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
- Install the dependencies:
pip install -r requirements.txt
- Initialize the database:
flask db init flask db migrate -m "Initial migration." flask db upgrade
- Run the application:
flask run
The application will run at http://127.0.0.1:5000/
.
-
POST /api/products: Add a new product (Admin only).
- Request body:
{ "name": "Product Name", "description": "Product Description", "price": 9.99 }
- Response:
201 Created
with the created product.
- Request body:
-
GET /api/products: Get a list of all products.
- Response:
200 OK
with a list of products.
- Response:
-
GET /api/products/: Get a product by ID.
- Response:
200 OK
with the product data, or404 Not Found
.
- Response:
-
PUT /api/products/: Update a product by ID (Admin only).
- Request body:
{ "name": "New Name", "description": "New Description", "price": 19.99 }
- Response:
200 OK
with the updated product, or404 Not Found
.
- Request body:
-
DELETE /api/products/: Delete a product by ID (Admin only).
- Response:
200 OK
with a message of successful deletion, or404 Not Found
.
- Response:
-
POST /api/orders: Create a new order.
- Request body:
{ "products": [{"product_id": 1, "quantity": 2}] }
- Response:
201 Created
with the created order.
- Request body:
-
PUT /api/orders/: Update the status of an order.
- Request body:
{ "status": "paid" }
- Response:
200 OK
with the updated order, or404 Not Found
.
- Request body:
-
POST /api/register: Register a new user.
- Request body:
{ "username": "user", "email": "user@example.com", "password": "password" }
- Response:
201 Created
with a success message.
- Request body:
-
POST /api/login: Log in a user.
- Request body:
{ "email": "user@example.com", "password": "password" }
- Response:
200 OK
with a success message.
- Request body:
-
POST /api/logout: Log out the current user.
- Response:
200 OK
with a success message.
- Response:
Contributions are welcome! Follow the steps below to contribute:
- Fork the project.
- Create a branch for your feature or bugfix (
git checkout -b feature/new-feature
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature/new-feature
). - Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for more information.