Logotipo Hedhog

Get Hedhog updates in your inbox

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

Back to LMS modulesLMS Submodule

LMS Submodule

instructors

Instructor profile management with a qualification/skill catalog, class-group assignment visibility, and enterprise-training-portal access toggling.

Source path: libraries/lms/src/instructor

Module file: instructor.module.ts

Introduction

The Instructors submodule manages the roster of people who can be assigned to teach class groups, layered on top of the same `person` records used elsewhere in the platform. Creating an instructor resolves or creates the underlying person (matching by `personId` or by email if not given), syncs contact info, and requires at least one qualification slug — the system seeds two defaults (`course-lessons`, `class-sessions`) on first list access and backfills any legacy `can_teach_courses` instructors into the `course-lessons` qualification, so older data stays queryable after the qualification model was introduced. Skills are a separate, looser tagging dimension (managed by `InstructorSkillController`/`instructor-skills`) used for searchable specialties rather than access control — unknown skill slugs are silently ignored rather than rejected, unlike qualification slugs which are strictly validated.

`PATCH /lms/instructors/:id/training-access` is the bridge into the Enterprise submodule's training portals: toggling it grants or revokes the `lms-instructor` platform role for the instructor's linked user account, which is what actually unlocks the `/lms/enterprise/training/instructor/*` endpoints for them — it has no DTO class and takes a single raw boolean body field. `GET /lms/instructors/me` is the self-service lookup an authenticated user calls to discover whether they themselves are registered as an instructor, returning `isInstructor: false` cleanly rather than erroring if not.

HTTP Endpoints

14 endpoints

Paginated instructor list; seeds default qualifications and backfills legacy instructors on first access.

Query
page, pageSize, search, status, qualificationSlugs

Aggregate instructor counts: total, active, inactive.

Whether the current user has a linked instructor profile; returns isInstructor:false cleanly if not.

Creates an instructor, resolving/creating the underlying person and syncing qualifications/skills.

Body

FieldTypeRequiredNotes
personIdnumbernoLink to an existing person
namestringyesMax 255 chars
qualificationSlugsstring[]yesArrayMinSize(1); must resolve to known active qualifications
emailstringnoMax 255 chars
phonestringnoMax 50 chars
avatarIdnumber | nullno
hourlyRatenumbernoMin 0
skillSlugsstring[]noUnknown slugs are silently ignored
status'active' | 'inactive'no

Class groups assigned to the instructor, with enrollment slot counts.

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

Full instructor detail; 404 if missing.

Params
id (int)

Grants or revokes the lms-instructor role for the linked user, unlocking the enterprise instructor portal.

Params
id (int)

Body

FieldTypeRequiredNotes
enabledbooleanyesRaw body field, not a DTO class

Updates instructor fields; re-syncs qualifications/skills/status only when explicitly supplied.

Params
id (int)

Deletes the instructor row (not the underlying person); 204 No Content.

Params
id (int)

Paginated skill list (search matches slug).

Query
page, pageSize, search

All active skills, unpaginated, for dropdown use.

Creates a skill.

Body

FieldTypeRequiredNotes
slugstringyesMax 255 chars
status'active' | 'inactive'noDefault active

Updates a skill; 404 if missing.

Params
id (int)

Deletes a skill; 404 if missing; 204 No Content.

Params
id (int)

MCP Tools

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

  • lms.instructors.list

    Lists instructors with optional pagination and filters

  • lms.instructors.stats

    Returns aggregate statistics for instructors

  • lms.instructors.me

    Returns the instructor profile linked to the authenticated user

  • lms.instructors.get

    Returns a single instructor by ID

  • lms.instructors.class-groups

    Lists class groups where an instructor is assigned

  • lms.instructors.create

    Creates a new instructor profile

  • lms.instructors.update

    Updates an existing instructor profile

  • lms.instructors.delete

    Deletes an instructor by ID

  • lms.instructors.training-access

    Enables or disables the training portal access for an instructor

  • lms.instructors.skills.list

    Lists instructor skills with optional pagination and search

  • lms.instructors.skills.all

    Returns all instructor skills (no pagination) for use in dropdowns

  • lms.instructors.skills.create

    Creates a new instructor skill

  • lms.instructors.skills.update

    Updates an instructor skill

  • lms.instructors.skills.delete

    Deletes an instructor skill by ID