Logotipo Hedhog

Get Hedhog updates in your inbox

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

Back to LMS modulesLMS Submodule

LMS Submodule

enterprise

Multi-tenant enterprise accounts that license courses and class groups to an organization, plus four role-scoped training portals (admin, instructor, viewer, student) for that organization's own staff.

Source path: libraries/lms/src/enterprise

Module file: enterprise.module.ts, enterprise/training/enterprise-training.module.ts

Introduction

The Enterprise submodule turns the LMS into a B2B product: an enterprise is a licensed organization (optionally linked to a CRM person/company) that gets its own slice of courses, class groups, users, and students, gated by a license limit. `EnterpriseController` is the platform-admin surface for managing these accounts — creating enterprises, linking/unlinking courses and class groups to them, adding enterprise users with a role (hr_manager, enterprise_admin, viewer), and managing the roster of enterprise students. Adding a user automatically grants the corresponding global platform role (`lms-enterprise-admin` for hr_manager/enterprise_admin) plus `lms-training-access`; removing the last enterprise link for a user revokes that access again. Linking a class group to an enterprise backfills any already-enrolled students into `enterprise_student` and records a license "assigned" event, keeping license consumption accurate even when enrollment happened before the enterprise link existed. Three public, unauthenticated endpoints stream course/class logo and banner images for use in enterprise-branded portal headers.

The other four controllers under `enterprise/training/` are the actual portals enterprise members use day-to-day, all reusing the Enterprise submodule's data rather than duplicating it. `TrainingAdminController` (role-gated, `/lms/enterprise/training/admin`) is the richest: dashboards, course/class-group browsing, a license management surface (assign/revoke, list with department/status filters), student and admin-user management scoped to the enterprise, and Portuguese-named reporting endpoints (`relatorios`, `avaliacoes`) for reports and evaluations. `TrainingInstructorController` gives an enterprise-linked instructor their own dashboard, their assigned class groups, attendance and material management (including file upload), and reports. `TrainingViewerController` is read-only and, notably, reuses `TrainingAdminService` directly rather than having its own service — there is no dedicated viewer business logic, just a narrower read-only controller surface over the same data. `TrainingStudentController` is the enterprise member-facing portal, decorated `@NoRole()` (any authenticated user, not a specific role) rather than `@Role()` like the other three, reflecting that any platform user can be an enterprise student without needing a platform-level role grant.

A point worth flagging for API consumers: most admin/instructor endpoints accept an optional `enterpriseId` query parameter to scope a multi-enterprise admin's view, but the viewer and student controllers mostly omit it (relying on implicit scoping from the authenticated user's own enterprise link) — except `TrainingViewerController`'s class-groups endpoint, which inconsistently still accepts it. Several admin/instructor write endpoints (assign license, add admin, submit attendance) take plain inline body shapes rather than DTOs, so they have no class-validator runtime validation.

HTTP Endpoints

84 endpoints

Streams the linked course's banner image for a class group.

Params
classId (int)

Paginated enterprise list with CRM/avatar and linked-resource counts.

Query
page, pageSize, search, status, crmPersonId

Creates an enterprise; 409 on duplicate slug.

Body

FieldTypeRequiredNotes
namestringyesMax 255 chars
slugstringno
status'active' | 'trial' | 'inactive' | 'suspended'no
crm_person_idnumber | nullno
portal_enabledbooleanno
license_limitnumber | nullno
notesstringno

Aggregate counts: total, active, trial, portal-enabled.

Distinct CRM persons linked to any enterprise, for picker UI.

Enterprise portal profiles available to the current user (auto-activates pending links); empty if unauthenticated.

KPIs, license usage, 12-month license timeline, and recent activity feed.

Params
id (int)

Single enterprise with CRM/company details and role-breakdown counts.

Params
id (int)

Updates enterprise fields.

Params
id (int)

Deletes the enterprise.

Params
id (int)

Paginated enterprise users with email/last-login.

Params
id (int)
Query
page, pageSize, search, status, role

Adds a user to the enterprise; auto-grants the matching global role plus lms-training-access.

Params
id (int)

Body

FieldTypeRequiredNotes
user_idnumberyes
role'hr_manager' | 'enterprise_admin' | 'viewer'yes
person_idnumber | nullno
status'active' | 'inactive' | 'pending'no

Updates role/status; re-applies global role mapping if role changed.

Params
id, userId (int)

Body

FieldTypeRequiredNotes
role'hr_manager' | 'enterprise_admin' | 'viewer'no
status'active' | 'inactive' | 'pending'no

Removes the link; revokes lms-training-access if no other enterprise links remain.

Params
id, userId (int)

Courses linked to the enterprise.

Params
id (int)
Query
page, pageSize, search, status

Links a course to the enterprise; 409 if already linked.

Params
id (int)

Body

FieldTypeRequiredNotes
course_idnumberyes
contracted_atstring | nullno

Unlinks a course.

Params
id, courseId (int)

Class groups linked to the enterprise.

Params
id (int)
Query
page, pageSize, search, status

Links a class group; backfills already-enrolled students into enterprise_student and logs a license event.

Params
id (int)

Body

FieldTypeRequiredNotes
course_class_group_idnumberyes

Unlinks a class group.

Params
id, classGroupId (int)

Enterprise students with primary email contact.

Params
id (int)
Query
page, pageSize, search, status

Adds a student; logs a license "assigned" event.

Params
id (int)

Body

FieldTypeRequiredNotes
person_idnumberyes
status'active' | 'inactive' | 'pending'no

Updates status; logs a license "status_changed" event if changed.

Params
id, personId (int)

Body

FieldTypeRequiredNotes
status'active' | 'inactive' | 'pending'no

Removes a student; logs a license "revoked" event.

Params
id, personId (int)

Training admin dashboard summary.

Query
enterpriseId?

Course completion stat aggregates.

Query
enterpriseId?

Paginated course list.

Query
enterpriseId?, page, pageSize, search, level, category

Course detail (admin view).

Params
courseId (int)
Query
enterpriseId?

Paginated class group list.

Query
enterpriseId?, page, pageSize, search, status, deliveryMode, instructorId?

Class group detail.

Params
id (int)

Students in a class group.

Params
id (int)
Query
page, pageSize, search, status

Sessions for a class group.

Params
id (int)

Materials for a class group.

Params
id (int)

License availability for the admin's enterprise(s).

Paginated license (student) list.

Query
page, pageSize, search, status, department

Assigns a license — creates/links a student record.

Body

FieldTypeRequiredNotes
namestringyes
emailstringno
departmentstringno

Revokes a license from a person.

Params
personId (int)

Students eligible to enroll in a class group.

Params
id (int)
Query
search?

Enrolls an existing student.

Params
id (int)

Body

FieldTypeRequiredNotes
personIdnumberyes

Creates a new student and enrolls them.

Params
id (int)

Body

FieldTypeRequiredNotes
namestringyes
emailstringno
departmentstringno

Student stats.

Query
enterpriseId?

Paginated student list.

Query
enterpriseId?, page, pageSize, search, status

Student profile/progress detail.

Params
personId (int)
Query
enterpriseId?

Admin user stats.

Query
enterpriseId?

Paginated admin list.

Query
enterpriseId?, page, pageSize, search, role

Adds an admin user to the enterprise.

Body

FieldTypeRequiredNotes
namestringyes
emailstringno
departmentstringno
rolestringno

Updates an admin's role.

Params
id (int)

Body

FieldTypeRequiredNotes
rolestringyes

Removes an admin.

Params
id (int)

Training admin reports.

Query
enterpriseId?, dateFrom?, dateTo?

Evaluation statistics.

Query
enterpriseId?

Paginated class groups with evaluation data.

Query
enterpriseId?, page, pageSize, search

Evaluation detail for a class group.

Params
classGroupId (int)
Query
enterpriseId?

Instructor dashboard summary.

Query
enterpriseId?

The instructor's assigned class groups.

Query
enterpriseId?, search, status, deliveryMode

Instructor reports.

Query
enterpriseId?, dateFrom?, dateTo?

Evaluation data for a class group.

Params
id (int)

Class group detail.

Params
id (int)

Students in the class group.

Params
id (int)
Query
page, pageSize, search, status

Sessions list.

Params
id (int)

Full attendance summary for the class group.

Params
id (int)

Materials list.

Params
id (int)

Download URL for a material.

Params
id, materialId (int)

Uploads a new material file to the class group.

Params
id (int)

Body

FieldTypeRequiredNotes
fileFileyesmultipart/form-data

Deletes a material.

Params
id, materialId (int)

Submits attendance for a specific session.

Params
id, sessionId (int)

Body

FieldTypeRequiredNotes
records{ studentId: number; present: boolean }[]yes

Viewer dashboard (delegates to the admin service, read-only).

Course stats.

Course list.

Query
page, pageSize, search, level, category

Course detail.

Params
courseId (int)

Class group list.

Query
enterpriseId?, search, status, deliveryMode

Class group detail.

Params
id (int)

Students.

Params
id (int)
Query
page, pageSize, search, status

Sessions.

Params
id (int)

Materials.

Params
id (int)

Student stats.

Paginated student list.

Query
page, pageSize, search, status

Student detail.

Params
personId (int)

Class groups the student is enrolled in.

Query
enterpriseId?, search, status, deliveryMode

Class group detail.

Params
id (int)

Sessions.

Params
id (int)

Materials available to the student.

Params
id (int)

The student's pending/submitted evaluation forms for this class group.

Params
id (int)

MCP Tools

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

  • lms.enterprise.list

    Lists enterprises with optional pagination and filters

  • lms.enterprise.stats

    Returns aggregate statistics for enterprises

  • lms.enterprise.crm-options

    Returns CRM person options available for enterprise linking

  • lms.enterprise.get

    Returns a single enterprise by ID

  • lms.enterprise.overview

    Returns an overview summary of an enterprise (users, courses, classes, students, licenses)

  • lms.enterprise.create

    Creates a new enterprise

  • lms.enterprise.update

    Updates an existing enterprise

  • lms.enterprise.delete

    Deletes an enterprise by ID

  • lms.enterprise.users.list

    Lists users belonging to an enterprise

  • lms.enterprise.users.add

    Adds a user to an enterprise

  • lms.enterprise.users.update

    Updates a user within an enterprise (e.g. change role)

  • lms.enterprise.users.remove

    Removes a user from an enterprise

  • lms.enterprise.courses.list

    Lists courses assigned to an enterprise

  • lms.enterprise.courses.add

    Assigns a course to an enterprise

  • lms.enterprise.courses.remove

    Removes a course from an enterprise

  • lms.enterprise.classes.list

    Lists class groups assigned to an enterprise

  • lms.enterprise.classes.add

    Assigns a class group to an enterprise

  • lms.enterprise.classes.remove

    Removes a class group from an enterprise

  • lms.enterprise.students.list

    Lists students belonging to an enterprise

  • lms.enterprise.students.add

    Adds a student to an enterprise

  • lms.enterprise.students.update

    Updates a student's data within an enterprise

  • lms.enterprise.students.remove

    Removes a student from an enterprise

  • lms.training-admin.dashboard

    Returns the training admin dashboard summary for the authenticated user

  • lms.training-admin.courses.list

    Lists courses visible to the authenticated training admin

  • lms.training-admin.courses.stats

    Returns course statistics for the authenticated training admin

  • lms.training-admin.courses.get

    Returns details of a specific course for the training admin

  • lms.training-admin.class-groups.list

    Lists class groups visible to the authenticated training admin

  • lms.training-admin.class-groups.get

    Returns details of a specific class group for the training admin

  • lms.training-admin.class-groups.students

    Lists students in a class group for the training admin

  • lms.training-admin.class-groups.sessions

    Lists sessions for a class group (training admin view)

  • lms.training-admin.class-groups.materials

    Lists materials for a class group (training admin view)

  • lms.training-admin.class-groups.enrollable-students

    Lists students that can be enrolled in a class group

  • lms.training-admin.class-groups.enroll

    Enrolls an existing student in a class group

  • lms.training-admin.class-groups.enroll-new

    Creates a new student and enrolls them in a class group

  • lms.training-admin.license-info

    Returns license availability info for the authenticated training admin

  • lms.training-admin.licenses.list

    Lists licenses managed by the authenticated training admin

  • lms.training-admin.licenses.assign

    Assigns a license to a user

  • lms.training-admin.licenses.revoke

    Revokes a license from a user

  • lms.training-admin.students.list

    Lists students visible to the authenticated training admin

  • lms.training-admin.students.stats

    Returns student statistics for the authenticated training admin

  • lms.training-admin.students.get

    Returns the profile and progress of a specific student

  • lms.training-admin.admins.list

    Lists admins for the enterprise

  • lms.training-admin.admins.stats

    Returns admin statistics for the enterprise

  • lms.training-admin.admins.add

    Adds a new admin to the enterprise

  • lms.training-admin.admins.update-role

    Updates the role of an admin within the enterprise

  • lms.training-admin.admins.remove

    Removes an admin from the enterprise

  • lms.training-admin.reports

    Returns admin reports for the enterprise

  • lms.training-admin.evaluations.stats

    Returns evaluation statistics for the enterprise

  • lms.training-admin.evaluations.list

    Lists class groups with evaluation data

  • lms.training-admin.evaluations.get

    Returns evaluation details for a specific class group

  • lms.training-instructor.dashboard

    Returns the training dashboard summary for the authenticated instructor

  • lms.training-instructor.class-groups.list

    Lists class groups assigned to the authenticated instructor

  • lms.training-instructor.class-groups.get

    Returns details of a specific class group for the authenticated instructor

  • lms.training-instructor.class-groups.students

    Lists students in a class group (instructor view)

  • lms.training-instructor.class-groups.sessions

    Lists sessions for a class group (instructor view)

  • lms.training-instructor.class-groups.attendance.get

    Returns the full attendance summary for a class group

  • lms.training-instructor.class-groups.attendance.submit

    Submits attendance records for a specific session

  • lms.training-instructor.class-groups.materials.list

    Lists materials for a class group (instructor view)

  • lms.training-instructor.class-groups.materials.delete

    Deletes a material from a class group

  • lms.training-instructor.class-groups.evaluations

    Returns evaluation data for a class group (instructor view)

  • lms.training-instructor.reports

    Returns reports for the authenticated instructor

  • lms.training-student.dashboard

    Returns the training dashboard summary for the authenticated student

  • lms.training-student.class-groups.list

    Lists class groups in which the authenticated student is enrolled

  • lms.training-student.class-groups.get

    Returns details of a specific class group for the authenticated student

  • lms.training-student.class-groups.sessions

    Lists sessions for a class group (student view)

  • lms.training-student.class-groups.materials

    Lists materials for a class group (student view)

  • lms.training-student.class-groups.my-evaluations

    Returns the evaluations submitted by the authenticated student for a class group

  • lms.training-student.streak.get

    Returns the authenticated student's learning streak data

  • lms.training-student.streak.register-activity

    Registers a learning activity for the authenticated student's streak