Skip to content

Group, Groupmember, groupTutorial, progress, solution, heartbeat#23

Open
Lav-Sen wants to merge 7 commits into
mainfrom
feat/groups
Open

Group, Groupmember, groupTutorial, progress, solution, heartbeat#23
Lav-Sen wants to merge 7 commits into
mainfrom
feat/groups

Conversation

@Lav-Sen

@Lav-Sen Lav-Sen commented Mar 9, 2026

Copy link
Copy Markdown

Summary

This PR introduces Group functionality for Blockly, enabling teachers to create and manage groups and allowing students to join them using an access code.

It also adds support for:

  • assigning tutorials to groups
  • tracking student progress
  • publishing Blockly solutions
  • tracking user activity (heartbeat / online status)

The implementation includes new API endpoints and corresponding database schemas.


Features

Groups

  • Create and manage groups
  • Retrieve group details
  • Update group name
  • Archive or delete groups

Group Members

  • Join groups via an access code
  • Leave groups
  • Teachers can view and remove members

Group Tutorials

  • Assign tutorials to groups
  • Remove tutorial assignments
  • Retrieve tutorials available to students
  • Manage tutorial release status

Progress Tracking

  • Track student progress in tutorials
  • Store currentPage, totalPages, and completion state
  • Track lastSeen activity for online status

Solutions

  • Students can publish their Blockly solutions
  • All group members can view published solutions
  • Solutions can be withdrawn

Heartbeat / Online Status

  • Track user activity via lastSeen
  • Online status is derived from recent activity

Added API Endpoints

Groups

  • POST /api/groups – Create a group (teacher)
  • GET /api/groups – Retrieve teacher's groups
  • GET /api/groups/dashboard – Retrieve teacher's groups
  • GET /api/groups/:groupId – Get group details (member)
  • PATCH /api/groups/:groupId – Update group name (teacher)
  • PATCH /api/groups/:groupId/archive – Archive group (teacher)
  • DELETE /api/groups/:groupId – Delete group (teacher)

Join / Leave Groups

  • POST /api/groups/join – Join a group via access code (student)
  • DELETE /api/groups/:groupId/leave – Leave a group (student)

Group Members

  • GET /api/groups/:groupId/members – Retrieve all members (teacher)
  • DELETE /api/groups/:groupId/members/:userId – Remove member (teacher)

Tutorials

  • GET /api/groups/:groupId/tutorials – Retrieve released tutorials (students)
  • GET /api/groups/:groupId/tutorials/manage – Retrieve tutorials with release status (teacher)
  • POST /api/groups/:groupId/tutorials – Assign tutorial to group (teacher)
  • DELETE /api/groups/:groupId/tutorials/:tutorialId – Remove tutorial assignment (teacher)

Solutions

  • GET /api/groups/:groupId/solutions – Retrieve all published solutions
  • POST /api/groups/:groupId/solutions – Publish a solution
  • DELETE /api/groups/:groupId/solutions/:solutionId – Withdraw a solution

Progress

  • PUT /api/groups/:pseudoUserId/progress – Retrieve all published solutions

Status

  • GET /api/groups/:pseudoUserId/heartbeat – Retrieve all published solutions

Database Schema

groups

  • _id
  • name
  • accessCode (unique)
  • teacherId
  • archived
  • createdAt
  • updatedAt

groupMembers

  • _id
  • groupId
  • userId
  • role (teacher | student)
  • joinedAt

groupTutorials

  • _id
  • groupId
  • tutorialId
  • assignedAt
  • assignedBy

progress

  • _id
  • userId
  • groupId
  • tutorialId
  • currentPage
  • totalPages
  • lastSeen
  • updatedAt

pseudoUsers

  • _id
  • name
  • nickname
  • groupId
  • sessionToken
  • onlineStatus
  • lastSeen
  • createdAt

solutions

  • _id
  • userId
  • groupId
  • tutorialId
  • blocklyXml
  • publishedAt

Notes

  • Authentication and authorization are enforced based on teacher and student roles.
  • Online status is derived from the lastSeen timestamp.
  • Solutions store the Blockly workspace as blocklyXml.

Comment thread helper/mongoConnection.js Outdated
Comment thread docker-compose.yml Outdated

@Thiemann96 Thiemann96 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From code review all in all looks solid! Please see the attached comments for improvements.

In Summary

  • keep track of code consistency across your implementation
  • if you write excessive docs, please make sure they are correct. otherwise just remove them (though a little bit of documentation what a function does is nice but you dont need to document every exception to the rule ;) )
  • remove logs from development

Comment thread routes/group/getAllGroup.js Outdated
Comment thread routes/group/postGroup.js Outdated
Comment thread routes/group/putGroup.js Outdated
claimed: false,
});

await student.save();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt this be checked if it returns true and if it returns true respond with a success response?

}

const group = await Group.findById(groupId);
if (!group) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reply to my commet above:

like you do here

Comment thread routes/groupSolution/removeGroupSolution.js Outdated
Comment thread routes/groupTutorial/getGroupTutorials.js Outdated
Comment thread routes/groupTutorial/getGroupTutorials.js
Comment thread routes/groupTutorial/postGroupTutorial.js Outdated
Comment thread routes/tutorial/getAllTutorials.js Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants