Skip to content

A backend system for customer support teams to log shift reports and trigger real-time notifications. Features include JWT authentication, role-based permissions, webhook dispatch via signals, and modular DRF ViewSets with filtering, pagination, and future-ready CSV export.

Notifications You must be signed in to change notification settings

waregagbagbo/CS-Employee-Activity-Tracker

Repository files navigation

Employee Activity Tracker for Customer Support

A Django-based system for customer support teams to log end-of-shift reports and provide managers/supervisors with real-time visibility into team activities and performance.

Project Structure

  • accounts/ – Custom user model and auth logic
  • shifts/ – Shift tracking and webhook triggers
  • reports/ – End-of-shift reporting and approval flow

🚀 Quickstart

  1. Clone the repo:

    git clone https://github.com/your-org/employee-activity-tracker.git
    cd employee-activity-tracker
    
  2. Create a virtual environment and install dependencies:

    Linux
    python -m venv env
    source env/bin/activate
    
    
    Windows
    python -m venv env
    venv\Scripts\activate
    
  3. Install dependencies

    pip install -r requirements.txt
    
  4. Set up .env and run migrations:

    python manage.py makemigrations  - schema version control
    python manage.py migrate - Applies changes
    
  5. Run the server:

     python manage.py runserver
    
    

API Endpoints

Authentication

  • POST /login/ - User login
  • POST /auth/register - User register
  • POST /auth/logout/ - User logout
  • POST /api/auth/refresh/ - Refresh JWT token. Also updates session-based auth tokens for compatibility with the accounts app.

Employee Management (Viewsets)/Generic

Uses a custom AbstractUser model with email as the primary identifier.
Signals ensure automatic profile creation and token regeneration on user creation.

  • GET /api/employees/ - List employees (paginated)
  • GET /api/employees/{id}/ - Get employee details
  • PUT /api/employees/{id}/ - Update employee profile

Shift Management (Viewsets)

  • GET /api/shifts/ - List shifts (with filters)
  • POST /api/shifts/ - Create new shift
  • GET /api/shifts/{id}/ - Get shift details
  • PUT /api/shifts/{id}/ - Update shift
  • PATCH /api/shifts/{id}/start/ - Start shift
  • PATCH /api/shifts/{id}/end/ - End shift

Activity Reports (Viewsets)

  • GET /api/reports/ - List reports (with filters)
  • POST /api/reports/ - Submit new report
  • GET /api/reports/{id}/ - Get report details
  • PUT /api/reports/{id}/ - Update report (if not approved)
  • PATCH /api/reports/{id}/approve/ - Approve report (supervisors/managers only)
  • GET /api/reports/export/ - Export reports (CSV)(Future) ONCE VALIDATED with Frontend library

Webhook Management

Webhooks are triggered on shift status changes (start/end). Implemented using Django signals and dispatched to registered endpoints test(https://webhook.site/).
Future support for multichannel registry.

Technical Considerations

Security

  • TokenAuth supported
  • Role-based access control (supervisors, agents,admins)
  • Input validation and permission checks
  • CORS configured for deployment

Performance

  • Database indexing on frequently queried fields (MySQL)
  • Pagination via DRF’s PageNumberPagination setting

Architecture

Development Environment Setup

Required Tools

  1. Python 3.9+
  2. Django 4.2+
  3. Django REST Framework
  4. MySQL 8.0+
  5. Git
  6. Code editor (Pycharm)
  7. Postman for endpoint tests

SAMPLE Results.

DRF Login (use case for SessionAuth) http://127.0.0.1:8000/accounts/api/login/

image

Authentication and permissions required for the view functionality (http://127.0.0.1:8000/cs/shifts/)

image

Token Auth in operation

image

About

A backend system for customer support teams to log shift reports and trigger real-time notifications. Features include JWT authentication, role-based permissions, webhook dispatch via signals, and modular DRF ViewSets with filtering, pagination, and future-ready CSV export.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published