curl --request GET \
--url https://api.example.com/api/recognition/stats/:employeeId{
"success": true,
"message": "<string>",
"data.stats": {
"totalPoints": 123,
"totalRecognitions": 123,
"badges": [
{}
],
"level": 123,
"recentAchievements": [
{
"_id": "<string>",
"recognitionType": "<string>",
"title": "<string>",
"description": "<string>",
"pointsAwarded": 123,
"badgeEarned": "<string>",
"issuedAt": "<string>"
}
]
}
}Get gamification statistics and achievements for an employee
curl --request GET \
--url https://api.example.com/api/recognition/stats/:employeeId{
"success": true,
"message": "<string>",
"data.stats": {
"totalPoints": 123,
"totalRecognitions": 123,
"badges": [
{}
],
"level": 123,
"recentAchievements": [
{
"_id": "<string>",
"recognitionType": "<string>",
"title": "<string>",
"description": "<string>",
"pointsAwarded": 123,
"badgeEarned": "<string>",
"issuedAt": "<string>"
}
]
}
}Authorization: Bearer YOUR_JWT_TOKEN
GET /api/recognition/stats/:employeeId
Show stats properties
src/services/recognitionService.js:116):
| Level | Points Required |
|---|---|
| 1 | 0 - 49 |
| 2 | 50 - 149 |
| 3 | 150 - 299 |
| 4 | 300 - 499 |
| 5 | 500+ |
curl -X GET https://api.cuido.com/api/recognition/stats/65a1b2c3d4e5f6a7b8c9d0e2 \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"success": true,
"message": "Estadísticas de gamificación obtenidas",
"data": {
"stats": {
"totalPoints": 325,
"totalRecognitions": 18,
"badges": [
"participativo",
"aprendiz",
"estrella"
],
"level": 4,
"recentAchievements": [
{
"_id": "65a1b2c3d4e5f6a7b8c9d0e7",
"recognitionType": "empleado_mes",
"title": "¡Empleado del Mes!",
"description": "Reconocimiento por tu excelente desempeño",
"pointsAwarded": 100,
"badgeEarned": "estrella",
"issuedAt": "2024-01-15T10:30:00.000Z"
},
{
"_id": "65a1b2c3d4e5f6a7b8c9d0e8",
"recognitionType": "curso_terminado",
"title": "¡Curso Completado!",
"description": "Has terminado exitosamente tu capacitación",
"pointsAwarded": 20,
"badgeEarned": "aprendiz",
"issuedAt": "2024-01-10T14:20:00.000Z"
},
{
"_id": "65a1b2c3d4e5f6a7b8c9d0e9",
"recognitionType": "curso_terminado",
"title": "¡Curso Completado!",
"description": "Has terminado exitosamente tu capacitación",
"pointsAwarded": 20,
"badgeEarned": "aprendiz",
"issuedAt": "2024-01-05T09:15:00.000Z"
},
{
"_id": "65a1b2c3d4e5f6a7b8c9d0ea",
"recognitionType": "encuesta_completada",
"title": "¡Encuesta Completada!",
"description": "Gracias por compartir tu feedback semanal",
"pointsAwarded": 5,
"badgeEarned": "participativo",
"issuedAt": "2024-01-02T11:30:00.000Z"
},
{
"_id": "65a1b2c3d4e5f6a7b8c9d0eb",
"recognitionType": "encuesta_completada",
"title": "¡Encuesta Completada!",
"description": "Gracias por compartir tu feedback semanal",
"pointsAwarded": 5,
"badgeEarned": "participativo",
"issuedAt": "2023-12-28T08:45:00.000Z"
}
]
}
}
}
src/services/recognitionService.js:98) performs:
pointsAwarded valuesbadgeEarned values{
"success": false,
"message": "No autorizado. Token inválido o expirado."
}
{
"success": false,
"message": "Empleado no encontrado"
}
{
"success": false,
"message": "Error obteniendo estadísticas de gamificación"
}
/api/recognition/ranking/:hospitalId - Get top employees by points// Display progress to next level
function getNextLevelProgress(stats) {
const levelThresholds = [0, 50, 150, 300, 500];
const currentLevel = stats.level;
const currentPoints = stats.totalPoints;
if (currentLevel === 5) {
return { progress: 100, pointsToNext: 0 };
}
const currentThreshold = levelThresholds[currentLevel - 1];
const nextThreshold = levelThresholds[currentLevel];
const pointsInLevel = currentPoints - currentThreshold;
const pointsNeeded = nextThreshold - currentThreshold;
return {
progress: (pointsInLevel / pointsNeeded) * 100,
pointsToNext: nextThreshold - currentPoints
};
}
src/routes/recognitionRoutes.js:21src/controllers/recognitionController.js:25src/services/recognitionService.js:97src/services/recognitionService.js:116src/models/Recognition.js