core PK: id 7 required 1 unique

Description

Training courses available for peer mentor certification and continuing education, supporting HLF formal certification requirements and Barnekreftforeningen onboarding programs. Courses are the catalog entries that users enroll in via course_enrollments, and certifications are issued upon completion.

23
Attributes
6
Indexes
6
Validation Rules
12
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key, globally unique course identifier
PKrequiredunique
organization_id uuid Owning organization — courses are scoped per tenant. NULL for platform-wide courses available to all organizations.
-
title string Human-readable course title displayed in the course catalog
required
description text Full course description shown on the course detail screen
-
course_type enum Category of course — drives certification issuance logic and UI presentation
required
status enum Lifecycle state of the course. Only active courses appear in the catalog.
required
certificate_type string Certificate type slug issued upon completion (e.g. 'peer-mentor-hlf'). NULL for non-certifying courses. Must match certificate_type values used in certifications table.
-
issues_certification boolean Whether completing this course triggers automatic certification issuance via certificate-service
required
certification_validity_months integer How many months a certification issued from this course remains valid before requiring renewal. NULL for courses that do not issue certifications.
-
provider string Course provider name (e.g. organization name, external training body)
-
duration_hours decimal Expected course duration in hours, used for display and planning
-
format enum Delivery format of the course
-
enrollment_limit integer Maximum number of enrollments allowed. NULL means unlimited.
-
enrollment_open_at datetime When enrollment opens. NULL means always open (while status is active).
-
enrollment_close_at datetime When enrollment closes. NULL means no deadline.
-
starts_at datetime Course start date/time for scheduled courses. NULL for self-paced.
-
ends_at datetime Course end date/time for scheduled courses. NULL for self-paced.
-
location string Physical or virtual location for in-person/hybrid courses
-
external_url string Link to external course platform or registration page if hosted outside Meander
-
metadata json Extensible key-value store for org-specific course attributes (e.g. Bufdir requirement tags, HLF regulation references)
-
created_by uuid User ID of the admin who created the course record
-
created_at datetime Record creation timestamp
required
updated_at datetime Last modification timestamp, updated on every write
required

Database Indexes

idx_courses_organization_id
btree

Columns: organization_id

idx_courses_status
btree

Columns: status

idx_courses_organization_status
btree

Columns: organization_id, status

idx_courses_certificate_type
btree

Columns: certificate_type

idx_courses_course_type
btree

Columns: course_type

idx_courses_enrollment_window
btree

Columns: enrollment_open_at, enrollment_close_at

Validation Rules

title_required error

Validation failed

certification_fields_consistency error

Validation failed

enrollment_dates_ordering error

Validation failed

enrollment_limit_positive error

Validation failed

duration_positive error

Validation failed

validity_months_positive error

Validation failed

Business Rules

active_only_in_catalog
always

Only courses with status='active' are returned by the course catalog. Draft and archived courses are invisible to mobile app users.

enrollment_window_enforcement
on_create

Enrollments are rejected if current timestamp is outside [enrollment_open_at, enrollment_close_at] when both are set.

enrollment_capacity_check
on_create

When enrollment_limit is set, new enrollments are rejected once the count of non-cancelled enrollments for this course reaches the limit.

certification_issuance_on_completion
on_update

When issues_certification=true and a course_enrollment transitions to status='completed', certificate-service automatically creates a certifications record with expires_at = completion_date + certification_validity_months.

org_scoped_catalog
always

The course catalog query returns courses where organization_id matches the authenticated user's organization OR organization_id IS NULL (platform-wide courses). Cross-tenant course records are never returned.

archived_course_no_new_enrollments
on_create

Courses with status='archived' cannot accept new enrollments. Existing active enrollments are unaffected.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage