core PK: id 10 required 1 unique

Description

Represents a training course, certification program, or career workshop that peer mentors and coordinators can register for. Covers both structured certification courses (e.g., HLF peer mentor certification) and facilitator-led career workshops (e.g., Blindeforbundet's two-day group guidance sessions). Completing a course may automatically issue a certification record.

22
Attributes
5
Indexes
8
Validation Rules
16
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key, generated as UUIDv4 on creation
PKrequiredunique
organization_id uuid Foreign key to organizations. Enforces multi-tenant isolation — courses are scoped to a single organization
required
title string Human-readable course title (e.g., 'Peer Mentor Certification Course', 'Career Workshop Day 1')
required
description text Full course description including objectives, agenda, and what participants will learn
-
course_type enum Classifies the course kind, driving display logic and certification issuance behavior
required
is_workshop boolean Convenience flag — true when course_type is 'workshop' or 'career_workshop'. Used by workshop-service to filter course records for the Workshop screens without requiring enum comparison in every query
required
status enum Lifecycle state of the course. Draft courses are not visible to peer mentors
required
facilitator_user_id uuid Foreign key to users. The coordinator or org admin responsible for running this course. Null for self-paced or externally facilitated courses
-
certification_type_id uuid Optional FK to certification_types. When set, completing this course automatically triggers issuance of the linked certification to the registered user
-
location string Physical address, venue name, or virtual meeting URL for the course
-
start_date datetime When the course begins (UTC). Used for sorting, calendar sync, and reminder notifications
-
end_date datetime When the course ends (UTC). Must be after start_date when both are set
-
registration_deadline datetime Last date/time registrations are accepted. Null means open until start_date. After this datetime the course registration service rejects new registrations
-
capacity integer Maximum number of participants. Null means unlimited. When current enrollment (count of active course_registrations) reaches this value, new registrations are rejected
-
prerequisites json Array of certification_type IDs the registrant must hold before registering. Validated by course-service at registration time. Example: ["peer-mentor-basic"]
-
is_recurring boolean Whether this course repeats on a schedule. When true, recurrence_config must be provided
required
recurrence_config json Recurrence rule object (e.g., {frequency: 'weekly', day_of_week: 1, end_after_occurrences: 8}). Only meaningful when is_recurring is true
-
metadata json Flexible key-value store for organization-specific course attributes such as external course IDs, material links, or Dynamics reference codes (HLF portal sync)
-
created_by uuid FK to users. The coordinator or org admin who created this course record
required
created_at datetime Record creation timestamp (UTC), set automatically on insert
required
updated_at datetime Last modification timestamp (UTC), updated on every write
required
cancelled_at datetime Populated when status transitions to 'cancelled'. Used to notify registered participants via course-notification-adapter
-

Database Indexes

idx_course_org_status
btree

Columns: organization_id, status

idx_course_org_start_date
btree

Columns: organization_id, start_date

idx_course_is_workshop
btree

Columns: organization_id, is_workshop, status

idx_course_certification_type
btree

Columns: certification_type_id

idx_course_facilitator
btree

Columns: facilitator_user_id

Validation Rules

title_not_empty error

Validation failed

valid_course_type error

Validation failed

valid_status_transition error

Validation failed

capacity_positive_integer error

Validation failed

recurrence_config_required_when_recurring error

Validation failed

valid_prerequisites_format error

Validation failed

registration_deadline_before_start error

Validation failed

published_requires_dates error

Validation failed

Business Rules

capacity_enforcement
on_create

When capacity is set, the number of active course_registrations (status != 'cancelled') must not exceed the capacity value. New registration attempts after capacity is reached are rejected with a capacity-full error

registration_deadline_enforcement
on_create

If registration_deadline is set and the current time is past that value, new registrations are rejected. The deadline is evaluated server-side in course-service at registration time

prerequisite_certification_check
on_create

When prerequisites array is non-empty, course-service must verify the registering user holds an active certification for each listed certification_type_id before accepting the registration

Enforced by: Course Service
org_scoped_visibility
always

Courses are only visible to users belonging to the same organization_id. All queries must include a WHERE organization_id = :orgId clause to enforce multi-tenant isolation

coordinator_only_create
on_create

Only users with Coordinator or Org Admin role within the organization may create or modify course records. Peer mentors have read-only access

certification_auto_issuance
on_update

When certification_type_id is set and a course_registration is marked as attended/completed, certificate-service is triggered to issue a new certification record for the participant

is_workshop_sync
on_create

The is_workshop boolean must be kept consistent with course_type: it must be true when course_type is 'workshop' or 'career_workshop', false otherwise. Enforced on insert and update

cancellation_notification
on_update

When status transitions to 'cancelled', cancelled_at is set and course-notification-adapter dispatches cancellation notifications to all active registrants

end_date_after_start
on_create

When both start_date and end_date are provided, end_date must be strictly after start_date

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage