Get Hedhog updates in your inbox
New releases, fresh recipes, and breaking changes — no spam.
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
| Field | Type | Required | Notes |
|---|---|---|---|
| personId | number | no | Link to an existing person |
| name | string | yes | Max 255 chars |
| qualificationSlugs | string[] | yes | ArrayMinSize(1); must resolve to known active qualifications |
| string | no | Max 255 chars | |
| phone | string | no | Max 50 chars |
| avatarId | number | null | no | — |
| hourlyRate | number | no | Min 0 |
| skillSlugs | string[] | no | Unknown 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
| Field | Type | Required | Notes |
|---|---|---|---|
| enabled | boolean | yes | Raw 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
| Field | Type | Required | Notes |
|---|---|---|---|
| slug | string | yes | Max 255 chars |
| status | 'active' | 'inactive' | no | Default 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.listLists instructors with optional pagination and filters
lms.instructors.statsReturns aggregate statistics for instructors
lms.instructors.meReturns the instructor profile linked to the authenticated user
lms.instructors.getReturns a single instructor by ID
lms.instructors.class-groupsLists class groups where an instructor is assigned
lms.instructors.createCreates a new instructor profile
lms.instructors.updateUpdates an existing instructor profile
lms.instructors.deleteDeletes an instructor by ID
lms.instructors.training-accessEnables or disables the training portal access for an instructor
lms.instructors.skills.listLists instructor skills with optional pagination and search
lms.instructors.skills.allReturns all instructor skills (no pagination) for use in dropdowns
lms.instructors.skills.createCreates a new instructor skill
lms.instructors.skills.updateUpdates an instructor skill
lms.instructors.skills.deleteDeletes an instructor skill by ID