curl --request POST \
--url https://api.example.com/api/microlearning/courses/:courseId/enroll \
--header 'Content-Type: application/json' \
--data '
{
"employeeId": "<string>"
}
'{
"success": true,
"message": "<string>",
"data.enrollment": {
"_id": "<string>",
"employeeId": "<string>",
"courseId": "<string>",
"progress": {
"status": "<string>",
"currentWeek": 123,
"certified": true
},
"timeSpent": 123,
"accessCount": 123,
"createdAt": "<string>"
}
}Enroll employees in microlearning courses
curl --request POST \
--url https://api.example.com/api/microlearning/courses/:courseId/enroll \
--header 'Content-Type: application/json' \
--data '
{
"employeeId": "<string>"
}
'{
"success": true,
"message": "<string>",
"data.enrollment": {
"_id": "<string>",
"employeeId": "<string>",
"courseId": "<string>",
"progress": {
"status": "<string>",
"currentWeek": 123,
"certified": true
},
"timeSpent": 123,
"accessCount": 123,
"createdAt": "<string>"
}
}Authorization: Bearer YOUR_JWT_TOKEN
POST /api/microlearning/courses/:courseId/enroll
Show enrollment properties
curl -X POST https://api.cuido.com/api/microlearning/courses/65a1b2c3d4e5f6a7b8c9d0e1/enroll \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"employeeId": "65a1b2c3d4e5f6a7b8c9d0e2"
}'
{
"success": true,
"message": "Inscripción exitosa",
"data": {
"enrollment": {
"_id": "65a1b2c3d4e5f6a7b8c9d0e3",
"employeeId": "65a1b2c3d4e5f6a7b8c9d0e2",
"courseId": "65a1b2c3d4e5f6a7b8c9d0e1",
"progress": {
"status": "inscrito",
"currentWeek": 1,
"certified": false
},
"timeSpent": 0,
"accessCount": 0,
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
}
}
}
{
"success": false,
"message": "Ya está inscrito en este curso"
}
{
"success": false,
"message": "No autorizado. Token inválido o expirado."
}
{
"success": false,
"message": "Curso o empleado no encontrado"
}
src/services/microLearningService.js:11) performs the following:
CourseEnrollment document with default valuescertificationType is aprobacion)src/routes/microLearningRoutes.js:21src/controllers/microLearningController.js:43src/services/microLearningService.js:11src/models/CourseEnrollment.js