👥 User Service

API Endpoints Documentation

📋 Service Information

Service Name: User Service

Port: 8051

Base URL: http://localhost:8051

Description: Handles employee management, roles, permissions, and user operations

Note: For user registration and authentication endpoints, please visit the Authentication Service at port 8050

POST /api/employee/add

Add Employee

Add a new employee to the system

📝 Request Example:

curl -X POST http://localhost:8051/api/employee/add \ -H "Content-Type: application/json" \ -d '{ ... }'

📄 Request Body:

{ "fullName": "Jane Smith", "email": "jane@example.com", "phone": "+1234567890", "password": "password123", "role": "EMPLOYEE", "roleId": 1, "branchId": 1, "servicId": 1, "status": true, "createdBy": "admin" }
201 - Success 409 - Conflict 500 - Server Error
GET /api/employee/getEmployee/{id}

Get Employee by ID

Retrieve employee details by ID

📝 Request Example:

curl -X GET http://localhost:8051/api/employee/getEmployee/1
📌 Path Parameters:

id - Employee ID (Long)

200 - Success 404 - Not Found 500 - Server Error
GET /api/employee/getAllEmployees

Get All Employees

Retrieve all employees with pagination and search

📝 Request Example:

curl -X GET "http://localhost:8051/api/employee/getAllEmployees?page=0&size=10&search=john"
📌 Query Parameters:

page - Page number (default: 0)

size - Page size (default: 10)

search - Search term (optional)

200 - Success 500 - Server Error
PUT /api/employee/update/{id}

Update Employee

Update employee information

📝 Request Example:

curl -X PUT http://localhost:8051/api/employee/update/1 \ -H "Content-Type: application/json" \ -d '{ ... }'

📄 Request Body:

{ "fullName": "Jane Smith Updated", "email": "jane.updated@example.com", "phone": "+1234567890", "role": "EMPLOYEE", "roleId": 1, "branchId": 1, "servicId": 1, "status": true }
📌 Path Parameters:

id - Employee ID (Long)

200 - Success 404 - Not Found 500 - Server Error
GET /api/employee/change-status/{id}

Change Employee Status

Toggle employee active/inactive status

📝 Request Example:

curl -X GET http://localhost:8051/api/employee/change-status/1
📌 Path Parameters:

id - Employee ID (Long)

200 - Success 404 - Not Found 500 - Server Error
GET /api/role/getAllRoles

Get All Roles

Retrieve all available roles in the system

📝 Request Example:

curl -X GET http://localhost:8051/api/role/getAllRoles
200 - Success 500 - Server Error
GET /api/service/getAllServices

Get All Services

Retrieve all available services in the system

📝 Request Example:

curl -X GET http://localhost:8051/api/service/getAllServices
200 - Success 500 - Server Error
GET /api/agency/getAllAgencies

Get All Agencies

Retrieve all available agencies in the system

📝 Request Example:

curl -X GET http://localhost:8051/api/agency/getAllAgencies
200 - Success 500 - Server Error