Skip to content

Ashish0243/Customer_Service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎯 ConnectDesk - Customer Service Platform

A comprehensive customer service ticketing system built with Django, featuring real-time chat functionality and automated ticket assignment. πŸš€

✨ Features

  • πŸ‘₯ User Management: Role-based system with customers and service providers
  • 🎫 Ticket Management: Create, track, and manage support tickets with UUID-based identification
  • πŸ’¬ Real-time Chat: WebSocket-based chat system for ticket communication
  • πŸ€– Automated Assignment: Intelligent ticket assignment to least busy service providers
  • πŸ”Œ RESTful API: Complete API endpoints for all operations
  • 🐳 Containerized: Docker-ready with MySQL and Redis support

πŸ› οΈ Tech Stack

  • 🐍 Backend: Django 5.1.7, Django REST Framework
  • πŸ—„οΈ Database: MySQL 8
  • ⚑ Cache/Message Broker: Redis
  • πŸ”Œ WebSockets: Django Channels with Redis channel layer
  • 🐳 Containerization: Docker & Docker Compose
  • 🐍 Python: 3.13

πŸ“ Project Structure

ConnectDesk/
β”œβ”€β”€ Customer_Service/          # Main Django project
β”‚   β”œβ”€β”€ settings.py           # Django settings
β”‚   β”œβ”€β”€ urls.py              # URL configuration
β”‚   β”œβ”€β”€ asgi.py              # ASGI configuration for WebSockets
β”‚   └── wsgi.py              # WSGI configuration
β”œβ”€β”€ home/                     # Main application
β”‚   β”œβ”€β”€ models.py            # Database models
β”‚   β”œβ”€β”€ views.py             # API views
β”‚   β”œβ”€β”€ serializers.py       # DRF serializers
β”‚   β”œβ”€β”€ consumers.py         # WebSocket consumers
β”‚   β”œβ”€β”€ signals.py           # Django signals
β”‚   └── urls.py              # App URLs
β”œβ”€β”€ requirements.txt          # Python dependencies
β”œβ”€β”€ Dockerfile               # Docker configuration
β”œβ”€β”€ docker-compose.yml       # Multi-container setup
└── manage.py               # Django management script

πŸ—οΈ Models Overview

πŸ‘€ CustomUser

  • Extends Django's AbstractUser
  • Role-based system: CUSTOMER or SERVICE_PROVIDER
  • Automatic group assignment via signals

🎫 Tickets

  • UUID-based primary key
  • Status tracking: OPEN, IN_PROGRESS, RESOLVED, CLOSED
  • Automatic assignment to least busy service provider
  • Links customers with service providers

πŸ’¬ ChatRoom & Messages

  • One-to-one relationship with tickets
  • Real-time messaging capability
  • Automatic room code generation

πŸš€ Installation & Setup

πŸ“‹ Prerequisites

  • 🐳 Docker & Docker Compose
  • 🐍 Python 3.13 (for local development)

🐳 Using Docker (Recommended)

  1. πŸ“₯ Clone the repository

    git clone <repository-url>
    cd ConnectDesk
  2. πŸ”¨ Build and run with Docker Compose

    docker-compose up --build
  3. πŸ”„ Run migrations

    docker-compose exec web python manage.py makemigrations
    docker-compose exec web python manage.py migrate
  4. πŸ‘€ Create superuser

    docker-compose exec web python manage.py createsuperuser
  5. 🌐 Access the application

πŸ’» Local Development Setup

  1. πŸ“¦ Install dependencies

    pip install -r requirements.txt
  2. βš™οΈ Configure database

    • Update DATABASES in settings.py for local MySQL setup
    • Or use SQLite for development
  3. πŸ”„ Run migrations

    python manage.py makemigrations
    python manage.py migrate
  4. πŸƒ Start development server

    python manage.py runserver

πŸ”Œ API Endpoints

πŸ‘₯ Users

  • GET /users/ - List all users
  • POST /users/ - Create new user
  • GET /users/{id}/ - Get user details
  • PUT /users/{id}/ - Update user
  • DELETE /users/{id}/ - Delete user

🎫 Tickets

  • GET /tickets/ - List all tickets
  • POST /tickets/ - Create new ticket
  • GET /tickets/{id}/ - Get ticket details
  • PUT /tickets/{id}/ - Update ticket
  • DELETE /tickets/{id}/ - Delete ticket

πŸ’¬ WebSocket Chat

  • ws://localhost:8000/ws/chat/{room_code} - Connect to chat room

πŸ’‘ Usage Examples

πŸ‘€ Creating a User

POST /users/
{
    "username": "john_doe",
    "password": "secure_password",
    "role": "CUSTOMER"
}

🎫 Creating a Ticket

POST /tickets/
{
    "customer_id": 1,
    "title": "Login Issue",
    "description": "Unable to log into my account"
}

πŸ’¬ WebSocket Chat Message

{
    "sender": 1,
    "message": "Hello, I need help with my account"
}

🎯 Key Features Explained

πŸ€– Automatic Ticket Assignment

  • New tickets are automatically assigned to the least busy service provider
  • Uses Django ORM annotations to count active tickets per provider

πŸ’¬ Real-time Chat

  • WebSocket-based communication using Django Channels
  • Messages are persisted in the database
  • Room-based chat linked to specific tickets

πŸ” Role-based Access

  • Automatic group assignment based on user role
  • Signal-based group management
  • Customizable permissions per role

βš™οΈ Configuration

🌍 Environment Variables

  • DJANGO_SETTINGS_MODULE: Django settings module
  • MYSQL_DATABASE: Database name
  • MYSQL_USER: Database user
  • MYSQL_PASSWORD: Database password

🐳 Docker Services

  • web: Django application server
  • db: MySQL 8 database
  • redis: Redis for caching and channel layer

πŸ‘¨β€πŸ’» Development

πŸ§ͺ Running Tests

python manage.py test

πŸ”„ Database Migrations

python manage.py makemigrations
python manage.py migrate

🐚 Accessing Django Shell

python manage.py shell

Troubleshooting

Common Issues

  1. Database Connection Error

    • Ensure MySQL service is running
    • Check database credentials in settings
  2. WebSocket Connection Failed

    • Verify Redis is running
    • Check channel layer configuration
  3. Permission Denied

    • Ensure user groups are properly assigned
    • Check role-based permissions

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support and questions, please create an issue in the repository or contact the development team.


Note: This is a development setup. For production deployment, ensure you:

  • Set DEBUG = False
  • Configure proper secret keys
  • Use environment variables for sensitive data
  • Set up proper logging
  • Configure static file serving
  • Use a production-grade web server (e.g., Gunicorn with Nginx)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published