A Django REST API backend for managing computer repair shop operations, including customer management, repair job tracking, and parts replacement records.
This project provides a comprehensive backend API for computer repair shops to manage their daily operations. It allows tracking customers, creating and managing repair jobs, assigning engineers, and recording replaced parts with costs.
- User Management: Custom user model with roles for staff and engineers
- Customer Management: Store customer details including contact information and address
- Repair Job Tracking: Create, update, and track repair jobs with device details, status, and assignments
- Parts Management: Record replaced parts with costs for each repair job (Model exists, API pending)
- Status Tracking: Monitor repair progress (pending, in progress, completed)
- Image Upload: Support for device images
- RESTful API: Built with Django REST Framework for easy integration
- Query Profiling: Integration with Django Silk for performance monitoring
- Backend: Django 6.0.1
- API Framework: Django REST Framework
- Authentication: JWT (JSON Web Tokens)
- Database: PostgreSQL
- Documentation: Markdown
- Python 3.8 or higher
- PostgreSQL database
- Git
-
Clone the repository:
git clone <repository-url> cd DRS_API
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Database Setup:
- Create a PostgreSQL database named
vedb - Update database credentials in
backend_api/backend_api/settings.pyif needed
- Create a PostgreSQL database named
-
Run migrations:
cd backend_api python manage.py makemigrations python manage.py migrate -
Create superuser:
python manage.py createsuperuser
cd backend_api
python manage.py runserverThe API will be available at http://127.0.0.1:8000/
Access the Django admin panel at http://127.0.0.1:8000/admin/ using the superuser credentials.
Access the Silk profiling dashboard at http://127.0.0.1:8000/silk/ (if configured).
POST /api/auth/register/- Register a new userPOST /api/auth/login/- Login and retrieve JWT tokensPOST /api/token/- Obtain JWT token pairPOST /api/token/refresh/- Refresh JWT access token
GET /api/job/- List all repair jobsPOST /api/job/create- Create a new repair jobGET /api/job/<id>/- Retrieve details of a specific repair jobGET /api/user-job/- List repair jobs created by the authenticated userGET /api/jobinfo/- Get job statistics
GET /api/customer/- List all customers
GET /api/user/- List all users
- Roles:
admin,owner,engineer - Extends Django's AbstractUser
customer_name,customer_phone,customer_email,addresscreated_attimestamp
customer(ForeignKey)- Device details:
device_type,device_brand,device_model,serial_number,device_image problem_descriptionstatus(pending, in_progress, completed)assigned_engineer(ForeignKey to CustomUser)created_by(ForeignKey to CustomUser)- Timestamps:
created_at,updated_at
repair_jab(ForeignKey to RepairJob)part_name,costrepaled_attimestamp
phone,otpexprie_at,verified
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.