Overview
This endpoint returns the user’s progress through their current weekly workout routine, including which day they’re on, how many days completed, and the current cycle number.
This endpoint does not require explicit JWT authentication in the route definition, but should be protected in production.
Endpoint
GET /api/rutina/:userId/progreso
Path Parameters
The MongoDB ObjectId of the user whose progress to retrieve
Response
Indicates if the request was successful
Progress information for the user’s routine Show Progress Object Properties
Zero-based index of the current day in the routine (0-6)
Name of the current day in Spanish Values: “lunes”, “martes”, “miércoles”, “jueves”, “viernes”, “sábado”, “domingo”
Total number of days in the routine (typically 7)
Number of days completed in the current cycle
Current cycle number (increments each time the user completes all days)
Complete data for the current day’s workout Whether this is a rest day
Training focus for the day
Whether this day has been completed
Total workout duration in minutes
Estimated calories to burn
List of exercises for this day
Code Examples
const userId = '507f1f77bcf86cd799439011' ;
const response = await fetch ( `https://api.fitaiid.com/api/rutina/ ${ userId } /progreso` , {
method: 'GET' ,
headers: {
'Content-Type' : 'application/json'
}
});
const data = await response . json ();
console . log ( 'Current day:' , data . data . diaActualNombre );
console . log ( 'Days completed:' , data . data . diasCompletados );
console . log ( 'Current cycle:' , data . data . cicloActual );
Response Example
{
"success" : true ,
"data" : {
"diaActualIndex" : 2 ,
"diaActualNombre" : "miércoles" ,
"totalDias" : 7 ,
"diasCompletados" : 2 ,
"cicloActual" : 1 ,
"diaActualData" : {
"nombre" : "Miércoles" ,
"esDescanso" : false ,
"enfoque" : "Piernas y glúteos" ,
"completado" : false ,
"duracionTotal" : 60 ,
"caloriasEstimadas" : 400 ,
"ejercicios" : [
{
"nombre" : "Sentadillas" ,
"series" : 4 ,
"repeticiones" : "12-15" ,
"descanso" : "60 segundos"
},
{
"nombre" : "Peso muerto rumano" ,
"series" : 3 ,
"repeticiones" : "12-15" ,
"descanso" : "60 segundos"
},
{
"nombre" : "Zancadas" ,
"series" : 3 ,
"repeticiones" : "10-12 por pierna" ,
"descanso" : "45 segundos"
}
]
}
}
}
Error Responses
Invalid user ID format {
"success" : false ,
"message" : "ID de usuario inválido"
}
User not found or no routine assigned {
"success" : false ,
"message" : "No hay rutina asignada"
}
Implementation Details
Progress Tracking System
The progress system tracks users through their weekly routine with automatic cycling:
Day Tracking
The system maintains a diaActualIndex (0-6) to track which day of the week the user is on.
Completion Tracking
Each day has a completado boolean flag that indicates whether it has been finished.
Automatic Cycling
When a user completes the last day (day 6), the system automatically resets to day 0 and increments the cicloActual counter.
Historical Data
Completed workouts are saved to fitnessStats.workoutHistory for analytics and achievements.
User Model Methods
This endpoint uses the following User model methods (defined in src/models/User.js):
getProgresoRutina()
getDiaActual()
// Returns progress information
user . getProgresoRutina ()
// Returns: { diaActualIndex, diaActualNombre, totalDias, diasCompletados, cicloActual, diaActualData }
If a user has no routine assigned (rutinaSemanal is empty), this endpoint will return a 404 error.
Use Cases
Dashboard Widget Display current workout progress on the user’s dashboard
Mobile App Sync Keep mobile app synchronized with user’s routine progress
Progress Analytics Track completion rates and adherence over time
Motivation Features Show streaks and achievements based on progress
Generate Routine Generate a new AI-powered routine
Workout History Get complete workout history
User Statistics View detailed workout statistics
Best Practices
Performance : This endpoint is lightweight and safe to call frequently (e.g., every time the user opens their workout screen).
Caching : Consider caching this data client-side and only refreshing after completing a workout or when the user explicitly requests an update.