core PK: id 10 required 1 unique

Description

Represents a training or certification course available for peer mentors and coordinators to register for. Supports course administration for HLF (formal certification renewal) and Barnekreftforeningen (onboarding/follow-up courses), with digital certificate issuance on completion.

17
Attributes
5
Indexes
6
Validation Rules
12
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key
PKrequiredunique
organization_id uuid Owning organization (tenant isolation)
required
title string Course display name
required
description text Course description shown on the listing screen
-
course_type enum Category of course
required
status enum Lifecycle state of the course
required
start_date datetime When the course begins
-
end_date datetime When the course ends
-
registration_deadline datetime Last date/time a user may register
-
max_participants integer Maximum number of registrations allowed; null = unlimited
-
location string Physical or virtual location of the course
-
is_online boolean Whether the course is delivered online
required
issues_certificate boolean Whether completing this course issues a digital peer mentor certificate
required
certificate_validity_months integer Months the issued certificate remains valid; null if certificate does not expire
-
created_by uuid User ID of the admin who created the course
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

title_not_empty error

Validation failed

end_date_after_start_date error

Validation failed

max_participants_positive_integer error

Validation failed

certificate_validity_positive error

Validation failed

valid_course_type_enum error

Validation failed

valid_status_enum error

Validation failed

Business Rules

registration_deadline_before_start
on_create

A course's registration deadline must be before or equal to its start date

Enforced by: CourseService
max_participants_enforcement
always

New registrations are rejected once course_registrations count reaches max_participants

published_only_visible_to_users
always

Only courses with status=published are shown on the mobile course listing; draft and archived are admin-only

certificate_validity_required_when_issues_certificate
on_create

If issues_certificate is true, certificate_validity_months should be set to drive renewal reminders; null is permitted only when the certificate never expires

Enforced by: CourseService
tenant_isolation
always

Courses are always scoped to their organization; cross-tenant reads are forbidden

archived_course_no_new_registrations
always

Courses with status=archived cannot accept new registrations

Enforced by: CourseService

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage