core PK: id 10 required 1 unique

Description

Represents a training or certification course that peer mentors and coordinators can register for. Supports formal certification workflows (HLF, Barnekreftforeningen) and mentor program sessions.

17
Attributes
5
Indexes
5
Validation Rules
10
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key
PKrequiredunique
organization_id uuid Owning organization — courses are org-scoped
required
title string Display name of the course
required
description text Full description of course content and objectives
-
course_type enum Category of course — certification courses issue peer mentor certificates; onboarding courses are for new peer mentor training; workshop courses are for group mentoring sessions
required
status enum Lifecycle status of the course
required
start_date datetime When the course begins
-
end_date datetime When the course ends
-
location string Physical or virtual location of the course
-
is_virtual boolean Whether the course is held online
required
max_participants integer Maximum number of participants allowed; null means unlimited
-
issues_certificate boolean Whether completing this course issues a peer mentor certificate
required
certificate_validity_months integer How many months a certificate issued by this course remains valid before renewal is required; null if no expiry
-
registration_deadline datetime Last date/time users can register for the course
-
created_by uuid User ID of the admin who created the course record
required
created_at datetime Record creation timestamp
required
updated_at datetime Last modification timestamp
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_start_date
btree

Columns: start_date

idx_courses_issues_certificate
btree

Columns: issues_certificate

Validation Rules

end_date_after_start_date error

Validation failed

registration_deadline_before_start error

Validation failed

title_not_empty error

Validation failed

max_participants_positive error

Validation failed

certificate_validity_positive error

Validation failed

Business Rules

registration_deadline_enforced
on_create

Users cannot register for a course after its registration_deadline has passed

max_participants_cap
on_create

If max_participants is set, new registrations are rejected once the confirmed registration count reaches the cap

certificate_validity_required_when_issues_certificate
on_create

If issues_certificate is true, certificate_validity_months must be provided unless the certificate has no expiry by design

org_scoped_course_access
always

Users may only view and register for courses belonging to their own organization

published_only_visible_to_users
always

Only courses with status=published are shown in the course list to peer mentors and coordinators; draft and archived courses are admin-only

certificate_renewal_reminder_triggered
on_create

When a course that issues_certificate is completed and a peer_mentor_certificate is created, the renewal reminder scheduler is notified to schedule a reminder at (issued_at + certificate_validity_months - 30 days)

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage