This project is a microservice for managing customer support tickets. It allows users to create, update, and track support tickets, with role-based access control for customers, support agents, and admins. The system also includes a notification feature for ticket assignments and status changes.
-
Clone the repository:
git clone https://github.com/your-username/support-ticket-system.git cd support-ticket-system
-
Install dependencies:
npm install
-
Set up Environment Variables: Create a
.env
file in the root directory and add the following variables:NEXT_PUBLIC_API_URL=your_api_url JWT_SECRET=your_jwt_secret MONGO_URI=your_mongodb_connection_string EMAIL=[email protected] EMAIL_PASSWORD=your_email_password
-
Start the server:
npm start
- POST /api/auth/register - Register a new user
- POST /api/auth/login - Login a user
- POST /api/tickets - Create a new ticket (Customer)
- GET /api/tickets - Get all tickets (Admin/Agent)
- GET /api/tickets/:id - Get ticket by ID (Authenticated Users)
- PUT /api/tickets/:id - Update a ticket (Admin/Agent)
- DELETE /api/tickets/:id - Delete a ticket (Admin)
- GET /api/users/profile - Get user profile (Authenticated Users)
- PUT /api/users/role - Update user role (Admin)
- GET /api/users - Get all users (Admin)
Use Postman or any other API client to test the endpoints. Ensure to include the Authorization header with the JWT token for protected routes.
- Fork the repository.
- Create a new branch:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature/your-feature-name
- Open a pull request.
Use an API client like Postman to test the various endpoints:
- POST /api/auth/register
{ "name": "John Doe", "email": "[email protected]", "password": "password123", "role": "customer" }
- POST /api/auth/login
{ "email": "[email protected]", "password": "password123" }
- POST /api/tickets
Headers:
{ "title": "Issue with product", "description": "Details about the issue", "priority": "high" }
{ "Authorization": "Bearer <JWT_TOKEN>" }
- GET /api/tickets
Headers:
{ "Authorization": "Bearer <JWT_TOKEN>" }
- GET /api/tickets/:id
Headers:
{ "Authorization": "Bearer <JWT_TOKEN>" }
- PUT /api/tickets/:id
Headers:
{ "status": "in progress" }
{ "Authorization": "Bearer <JWT_TOKEN>" }
- DELETE /api/tickets/:id
Headers:
{ "Authorization": "Bearer <JWT_TOKEN>" }
- GET /api/users/profile
Headers:
{ "Authorization": "Bearer <JWT_TOKEN>" }
- PUT /api/users/role
Headers:
{ "email": "[email protected]", "role": "agent" }
{ "Authorization": "Bearer <JWT_TOKEN>" }
- GET /api/users
Headers:
{ "Authorization": "Bearer <JWT_TOKEN>" }