Workout API mande in Node.js
Starts the allocation process for a workout
Expected body request:
{
"workout_id": 2,
"participants": [
2, 3, 4, 5, 6
]
}
Expected response:
{
"allocations": [
{
"user_id": 2,
"sensor_id": 5,
"sensor_is_user_property": true
},
{
"user_id": 3,
"sensor_id": 8,
"sensor_is_user_property": true
},
{
"user_id": 4,
"sensor_id": 1,
"sensor_is_user_property": false
},
{
"user_id": 5,
"sensor_id": 10,
"sensor_is_user_property": true
},
{
"user_id": 6,
"sensor_id": 4,
"sensor_is_user_property": false
}
],
"participants_without_allocation": []
}
Fetches the allocations of a workout
Expected response:
{
"allocations": [
{
"user_id": 2,
"sensor_id": 5,
"sensor_is_user_property": true
},
{
"user_id": 6,
"sensor_id": 1,
"sensor_is_user_property": false
},
{
"user_id": 9,
"sensor_id": 4,
"sensor_is_user_property": true
},
{
"user_id": 11,
"sensor_id": 4,
"sensor_is_user_property": false
},
{
"user_id": 14,
"sensor_id": 7,
"sensor_is_user_property": false
}
]
}
Receives a socket.io connection
Receives a complaining that the sensor allocated is not working
Broadcasts allocation data whenever new allocations are made
Emits back to the person complaining about its sensor which new sensor was allocated to the current workout.