The Order Management System is a RESTful API built using Flask and SQLAlchemy. This application enables users to manage customers, products, and orders through a set of API endpoints. Key features include:
- Customer Management: Create, retrieve, update, and delete customer records.
- Product Management: Create, retrieve, update, and delete product records.
- Order Management: Create, retrieve, update, and delete orders, with automatic total price calculation and quantity validation.
The application uses an SQLite database to persist data and supports basic CRUD operations for managing data.
-
Customer Management:
- Create a new customer.
- Retrieve customer details by ID.
- Update customer information.
- Delete a customer record.
-
Product Management:
- Create a new product.
- Retrieve product details by ID.
- Update product information.
- Delete a product record.
-
Order Management:
- Create a new order with specified product IDs.
- Retrieve order details by ID.
- Update an existing order.
- Delete an order.
- Automatic Total Price Calculation: Calculates total price based on product quantities.
- Quantity Validation: Ensures sufficient stock before order creation or update.
-
Clone the Repository:
git clone https://github.com/yourusername/order_management.git cd order_management -
Set Up a Virtual Environment:
python -m venv venv source venv/bin/activate -
Install Dependencies:
Ensure you have a
requirements.txtfile with the following content:Flask Flask-SQLAlchemyInstall the dependencies:
pip install -r requirements.txt
-
Initialize the Database:
Run the Flask application to set up the SQLite database and create the necessary tables:
python app.py