Logotipo Hedhog

Get Hedhog updates in your inbox

New releases, fresh recipes, and breaking changes — no spam.

Back to LMS modulesLMS Submodule

LMS Submodule

class-groups

Instructor-led classes with calendar sessions (including recurrence), student enrollment, attendance tracking, and class materials.

Source path: libraries/lms/src/class-group

Module file: class-group.module.ts

Introduction

The Class Groups submodule models instructor-led, scheduled offerings of a course — distinct from the on-demand course content managed by the Courses submodule. A class group binds a course to a delivery mode (presential, online, or hybrid), a date range, an optional instructor, and a capacity, and becomes the unit that students actually enroll into and attend.

Enrollment supports two paths: linking an existing person (`POST /lms/classes/:id/students`) or creating a brand-new person record and enrolling them in the same call (`POST /lms/classes/:id/students/create`), which is the common path for walk-in or phone registrations where the person has no prior CRM record. `GET /lms/classes/:id/people/search` powers the enrollment picker UI by searching the broader person directory for enrollment candidates.

Calendar sessions are the actual meeting occurrences of a class group. A session can be created standalone or generated as a recurring series via a `recurrence` block (daily/weekly/monthly/yearly frequency, interval, until-date, and day-of-week selection for weekly patterns) — both at class-group creation time (`sessionTemplate`) and when adding sessions directly. Updates and deletes accept a `scope` of `single` or `series`, letting an editor change just one occurrence or the entire recurring pattern; deletion validates this via a query parameter while update validates it as a body field, an inconsistency worth knowing about. Attendance is recorded per session as a full replace-style array of `{studentId, present, justification?}` entries rather than incremental toggles, simplifying the save logic for an attendance-taking UI.

Materials (files or external links) can be attached either to the class group as a whole or scoped to one specific session, letting an instructor share session-specific handouts alongside general course materials. Note that an `UpdateMaterialDto` exists in source but has no corresponding controller route — materials can be created and deleted but not edited in place today.

HTTP Endpoints

22 endpoints

Paginated, filterable class group list.

Query
page, pageSize, search, status, deliveryMode, courseId

Aggregate class group stats.

Full class group details.

Params
id (int)

Creates a class group, optionally generating a recurring session series from sessionTemplate.

Body

FieldTypeRequiredNotes
codestringyesUnique, max 50 chars
courseIdnumberyes
titlestringyesMax 255 chars
deliveryMode'presential' | 'online' | 'hybrid'yes
startDatestring (ISO8601)yes
instructorIdnumberno
descriptionstringno
status'open' | 'ongoing' | 'completed' | 'cancelled'no
endDatestring (ISO8601)no
startTimestring (HH:MM)no
endTimestring (HH:MM)no
weekDaysstringno
capacitynumbernoMin 1
locationstringno
virtualRoomUrlstringnoMax 500 chars
sessionTemplateClassGroupSessionTemplateDtono{ title, description?, location?, meetingUrl?, color?, recurrence? }

Updates class group fields (all optional).

Params
id (int)

Deletes a class group.

Params
id (int)

Lists enrolled students.

Params
id (int)
Query
search

Enrolls an existing person.

Params
id (int)

Body

FieldTypeRequiredNotes
personIdnumberyes

Creates a new person and enrolls them in one call.

Params
id (int)

Body

FieldTypeRequiredNotes
namestringyesMax 255 chars
emailstringnoMax 255 chars
phonestringnoMax 50 chars

Student's enrollment profile/progress within the class group.

Params
id, personId (int)

Updates student name/email/phone.

Params
id, personId (int)

Removes the student's enrollment.

Params
id, personId (int)

Lists calendar sessions.

Params
id (int)

Adds a session, optionally expanding into a recurring series.

Params
id (int)

Body

FieldTypeRequiredNotes
titlestringyesMax 255 chars
sessionDatestring (ISO8601)yes
startTimestring (HH:MM)yes
endTimestring (HH:MM)yes
descriptionstringno
locationstringno
meetingUrlstringnoMax 500 chars
colorstring (#RRGGBB)no
status'scheduled' | 'completed' | 'cancelled'no
instructorIdnumberno
recurrenceSessionRecurrenceDtono{ frequency, interval?, until, daysOfWeek? }

Updates a session.

Params
id, sessionId (int)

Body

FieldTypeRequiredNotes
applyScope'single' | 'series'noWhether the update applies to this occurrence or the whole recurring series

Deletes a session; scope=series removes all recurrences.

Params
id, sessionId (int)
Query
scope (single | series)

Attendance records for a session.

Params
id, sessionId (int)

Saves/overwrites attendance for a session.

Params
id, sessionId (int)

Body

FieldTypeRequiredNotes
attendanceAttendanceEntryDto[]yes{ studentId, present, justification? }[]

Lists materials, optionally filtered to one session.

Params
id (int)
Query
sessionId?

Creates a material (file or external link).

Params
id (int)

Body

FieldTypeRequiredNotes
titlestringyesMax 255 chars
materialType'file' | 'link'yes
descriptionstringno
fileIdnumbernoRequired when materialType=file
urlstringnoRequired when materialType=link, max 500 chars
sessionIdnumberno
sortOrdernumberno

Deletes a material.

Params
id, materialId (int)

MCP Tools

Named tools callable by AI models via the Model Context Protocol (MCP).

  • lms.classes.list

    Lists class groups with optional pagination and filters

  • lms.classes.stats

    Returns summary statistics for class groups

  • lms.classes.get

    Returns a single class group by ID with full details

  • lms.classes.create

    Creates a new class group

  • lms.classes.update

    Updates an existing class group

  • lms.classes.delete

    Removes a class group by ID

  • lms.classes.people-search

    Searches for people that can be added to a class group as students

  • lms.classes.students.list

    Lists students enrolled in a class group

  • lms.classes.students.enroll

    Enrolls an existing person as a student in a class group

  • lms.classes.students.enroll-new

    Creates a new person and immediately enrolls them in a class group

  • lms.classes.students.get

    Returns the profile and progress of a specific student in a class group

  • lms.classes.students.update

    Updates a student's profile data within a class group

  • lms.classes.students.remove

    Removes a student from a class group

  • lms.classes.sessions.list

    Lists all sessions scheduled for a class group

  • lms.classes.sessions.create

    Creates a new session for a class group, with optional recurrence

  • lms.classes.sessions.update

    Updates a session in a class group

  • lms.classes.sessions.delete

    Deletes a session; use scope=series to delete a whole recurring series

  • lms.classes.sessions.attendance.get

    Returns the attendance list for a specific session

  • lms.classes.sessions.attendance.save

    Saves attendance records for a session

  • lms.classes.materials.list

    Lists materials for a class group, optionally filtered by session

  • lms.classes.materials.create

    Creates a new material (file or link) for a class group

  • lms.classes.materials.delete

    Deletes a material from a class group