Lesson scaffolding
Module Sequence Modification API
Endpoint
POST /modules/sequences/users/{userId}
Description
This endpoint allows for the modification of a user's module sequence by creating custom routing between modules. It can be used to implement both module insertion (scaffolding) and module skipping/bypassing functionality.
Request Parameters
Path Parameters
userId
(required): The unique identifier of the user whose module sequence is being modified
Request Body
{
"originModuleId": number,
"destinationModuleId": number
}
originModuleId
(required): The ID of the source module where the sequence startsdestinationModuleId
(required): The ID of the target module where the sequence ends
Use Cases
Adding Additional Modules (Scaffolding)
To insert an additional module between two existing modules in the sequence:
Create the new module that will be inserted
Make two sequence calls to this endpoint:
First call: Connect the preceding module to the new module
Second call: Connect the new module to the subsequent module
Example:
// First call - Connect Module 1 to Module 2.4
{
"originModuleId": 1,
"destinationModuleId": 24
}
// Second call - Connect Module 2.4 to Module 3
{
"originModuleId": 24,
"destinationModuleId": 3
}
Bypassing/Skipping Modules
To skip a module in the sequence:
Create a sequence that bypasses the module to be skipped by connecting the modules before and after it directly
Example:
// To skip Module 2, connect Module 1 directly to Module 3
{
"originModuleId": 1,
"destinationModuleId": 3
}
Notes
The sequence modifications are user-specific and do not affect the default course structure for other users
Multiple sequences can be created for a single user to build complex learning paths
These modifications override the default module progression path for the specific user
The sequence changes are additive - they don't remove existing sequences but provide alternative paths
Response
200 OK: Sequence created successfully
400 Bad Request: Invalid module IDs or sequence configuration
404 Not Found: User or module not found
Example Implementation
async function addScaffoldingModule(
userId: number,
originalModuleId: number,
newModuleId: number,
nextModuleId: number
) {
// Create first sequence
await axios.post(`/modules/sequences/users/${userId}`, {
originModuleId: originalModuleId,
destinationModuleId: newModuleId
});
// Create second sequence
await axios.post(`/modules/sequences/users/${userId}`, {
originModuleId: newModuleId,
destinationModuleId: nextModuleId
});
}
Last updated