The Vendor Management System is a Django-based web application that allows you to manage vendors, track purchase orders, and evaluate vendor performance metrics.
- Vendor Profile Management: Create, retrieve, update, and delete vendor profiles.
- Purchase Order Tracking: Create, retrieve, update, and delete purchase orders associated with vendors.
- Vendor Performance Evaluation: Calculate and retrieve performance metrics for each vendor, including on-time delivery rate, quality rating average, average response time, and fulfillment rate.
-
Clone the repository:
git clone https://github.com/musaddiq-jbs/vendor-management-system.git
-
Navigate to the project directory:
cd vendor-management-system
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
-
For Windows:
venv\Scripts\activate
-
For macOS and Linux:
source venv/bin/activate
-
-
Install the dependencies:
pip install -r requirements.txt
-
Apply database migrations:
python manage.py migrate
-
Create a superuser account:
python manage.py createsuperuser
-
Start the development server:
python manage.py runserver
-
Access the API documentation at
http://localhost:8000/swagger/
.
The following API endpoints are available:
- Obtain an access token:
-
Endpoint:
POST /api/token/
-
Request Body:
{ "username": "your-username", "password": "your-password" }
-
-
Create a new vendor:
-
Endpoint:
POST /api/vendors/
-
Request Body:
{ "name": "New Vendor", "contact_details": "[email protected]", "address": "123 New Street", "vendor_code": "NEW001" }
-
-
List all vendors:
- Endpoint:
GET /api/vendors/
- Endpoint:
-
Retrieve a specific vendor's details:
- Endpoint:
GET /api/vendors/{vendor_id}/
- Endpoint:
-
Update a vendor's details:
-
Endpoint:
PUT /api/vendors/{vendor_id}/
-
Request Body:
{ "name": "Updated Vendor", "contact_details": "[email protected]" }
-
-
Delete a vendor:
- Endpoint:
DELETE /api/vendors/{vendor_id}/
- Endpoint:
-
Create a purchase order:
-
Endpoint:
POST /api/purchase_orders/
-
Request Body:
{ "po_number": "PO001", "vendor": 1, "delivery_date": "2023-06-30", "items": [{"name": "Item 1", "quantity": 10}], "quantity": 10, "status": "pending" }
-
-
List all purchase orders:
- Endpoint:
GET /api/purchase_orders/
- Endpoint:
-
Retrieve details of a specific purchase order:
- Endpoint:
GET /api/purchase_orders/{po_id}/
- Endpoint:
-
Update a purchase order:
-
Endpoint:
PUT /api/purchase_orders/{po_id}/
-
Request Body:
{ "status": "completed" }
-
-
Delete a purchase order:
- Endpoint:
DELETE /api/purchase_orders/{po_id}/
- Endpoint:
-
Acknowledge a purchase order:
- Endpoint:
POST /api/purchase_orders/{po_id}/acknowledge/
- Endpoint:
- Retrieve a vendor's performance metrics:
- Endpoint:
GET /api/vendors/{vendor_id}/performance/
- Endpoint:
The API endpoints are secured using token-based authentication (JWT). To access the protected endpoints, include the JWT token in the Authorization
header of your requests as Bearer your-access-token
.
To run the test suite, execute the following command:
python manage.py test vendors
This will run all the tests defined in the vendors/tests.py
file.