Skip to content

RameshPrabakar/sap-btp-helpdesk-cap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎫 IT Helpdesk Ticket Management System

Built with SAP Cloud Application Programming Model (CAP) + Node.js + SQLite

IT Helpdesk application that manages support tickets, agents, and SLAs using SAP CAP framework.


Features

  • ✅ Create & manage support tickets with auto-generated ticket numbers (TKT-2024-00001)
  • ✅ Track ticket lifecycle: OPEN → IN_PROGRESS → RESOLVED → CLOSED
  • ✅ Priority levels: LOW | MEDIUM | HIGH | CRITICAL
  • ✅ Automatic SLA due-date calculation based on category
  • ✅ Assign agents, escalate, resolve, close and reopen tickets
  • ✅ Comments system (public & internal notes)
  • ✅ Full audit trail for every action
  • ✅ Dashboard statistics
  • ✅ Overdue ticket detection

Tech Stack

Layer Technology
Backend Framework SAP CAP (Cloud Application Programming Model)
Runtime Node.js
Database (local) SQLite (via @cap-js/sqlite)
API OData V4 (auto-generated by CAP)
Testing Jest + Supertest

Project Structure

helpdesk-cap/
├── 📁 db/
│   ├── schema.cds              ← Data model (entities, types, enums)
│   └── data/                   ← CSV seed data for local dev
│       ├── helpdesk-Categories.csv
│       ├── helpdesk-Departments.csv
│       ├── helpdesk-Agents.csv
│       ├── helpdesk-Employees.csv
│       └── helpdesk-Tickets.csv
├── 📁 srv/
│   ├── helpdesk-service.cds    ← Service definition (OData endpoints + actions)
│   └── helpdesk-service.js     ← Business logic handlers (Node.js)
├── 📁 test/
│   └── helpdesk.test.js        ← Jest test suite
├── package.json
├── .cdsrc.json
└── README.md

🚀 Getting Started

Prerequisites

  • Node.js 20+
  • npm 9+

1. Clone the repo

git clone https://github.com/RameshPrabakar/sap-btp-helpdesk-cap.git
cd sap-btp-helpdesk-cap

2. Install dependencies

npm install

3. Run locally with hot reload

npm run dev

The API is now live at: http://localhost:4004

4. Explore the API

Open your browser and visit:

http://localhost:4004

You'll see all available endpoints:

  • /helpdesk → Main helpdesk service
  • /admin → Admin management service

API Reference

OData Endpoints (Auto-generated)

Method Endpoint Description
GET /helpdesk/Tickets List all tickets
POST /helpdesk/Tickets Create new ticket
GET /helpdesk/Tickets(:ID) Get single ticket
PATCH /helpdesk/Tickets(:ID) Update ticket
GET /helpdesk/Agents List active agents
GET /helpdesk/Categories List categories
GET /helpdesk/AuditLogs View audit trail

Custom Actions

Method Endpoint Body Description
POST /helpdesk/assignAgent {ticketID, agentID, remarks} Assign agent to ticket
POST /helpdesk/resolveTicket {ticketID, resolutionNote, agentName} Mark ticket as resolved
POST /helpdesk/closeTicket {ticketID, agentName} Close a resolved ticket
POST /helpdesk/escalateTicket {ticketID, reason, agentName} Escalate ticket priority
POST /helpdesk/reopenTicket {ticketID, reason, agentName} Reopen resolved/closed ticket
POST /helpdesk/changePriority {ticketID, priority, reason} Change priority

Custom Functions

Method Endpoint Description
GET /helpdesk/getDashboardStats() Get ticket statistics
GET /helpdesk/getOverdueTickets() List overdue tickets
GET /helpdesk/getAgentTickets(agentID='...') Tickets assigned to an agent

Example API Calls

Create a Ticket

curl -X POST http://localhost:4004/helpdesk/Tickets \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Cannot connect to company WiFi",
    "description": "My laptop stopped detecting the office WiFi network after the latest Windows update",
    "priority": "HIGH",
    "category_ID": "cat-0003",
    "department_ID": "dept-0001",
    "reporter_ID": "emp-0001"
  }'

Assign an Agent

curl -X POST http://localhost:4004/helpdesk/assignAgent \
  -H "Content-Type: application/json" \
  -d '{
    "ticketID": "<ticket-uuid>",
    "agentID": "agt-0003",
    "remarks": "Assigning to L2 support for network issues"
  }'

Resolve a Ticket

curl -X POST http://localhost:4004/helpdesk/resolveTicket \
  -H "Content-Type: application/json" \
  -d '{
    "ticketID": "<ticket-uuid>",
    "resolutionNote": "WiFi issue fixed by rolling back the Windows network driver update",
    "agentName": "Mike Chen"
  }'

Get Dashboard Stats

curl http://localhost:4004/helpdesk/getDashboardStats()

Filter Open Critical Tickets

curl "http://localhost:4004/helpdesk/Tickets?\$filter=status eq 'OPEN' and priority eq 'CRITICAL'"

Running Tests

npm test

Tests cover:

  • Ticket creation validation
  • OData queries & filters
  • Assign agent action
  • Resolve & close lifecycle
  • Escalation logic
  • Dashboard statistics
  • Comment creation

Data Model Overview

Departments ──< Employees ──< Tickets >── Agents
                                │
                            Categories
                                │
                    ┌───────────┴────────────┐
                 Comments              AuditLogs
                 Attachments

Roadmap (Future Improvements)

  • Add React frontend with SAP UI5 Web Components
  • Email notifications on ticket assignment/resolution
  • SAP HANA Cloud support for production deployment
  • Role-based access control (RBAC)
  • File attachment upload support
  • SLA breach alerts
  • Deploy to SAP BTP Cloud Foundry

Learning Resources


📄 License

MIT License — feel free to use this project for learning and practice.

About

IT Helpdesk Ticket Management System — CAP Project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors