core PK: id 12 required 1 unique

Description

Represents a structured learning or certification event that peer mentors and coordinators can register for. Tracks course metadata, scheduling, capacity, and certificate eligibility within the Certification & Training module.

20
Attributes
4
Indexes
7
Validation Rules
11
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key, generated server-side
PKrequiredunique
organization_id uuid Owning organization — scopes course visibility to a single tenant
required
title string Display name of the course
required
description text Full course description shown on the listing and detail screens
-
course_type enum Classification of the course format
required
status enum Lifecycle state of the course
required
start_date datetime When the course begins (UTC)
required
end_date datetime When the course ends (UTC); must be after start_date
required
registration_deadline datetime Last datetime a user may enroll; must be before start_date. Null means open until start.
-
location string Physical address or venue name. Null for fully online courses.
-
is_online boolean True when the course is delivered entirely online
required
online_url string Meeting or streaming URL for online courses. Required when is_online=true.
-
max_participants integer Capacity cap. Null means unlimited.
-
awards_certificate boolean Whether completing this course generates a digital peer mentor certificate record
required
certificate_validity_months integer How many months a certificate issued from this course remains valid. Null = no expiry.
-
instructor_name string Name of the course instructor or facilitator, shown on detail screen
-
instructor_notes text Internal notes for coordinators about the instructor or delivery format; not shown to peer mentors
-
created_by uuid User ID of the admin or coordinator who created the course record
required
created_at datetime Record creation timestamp (UTC)
required
updated_at datetime Last modification timestamp (UTC)
required

Database Indexes

idx_courses_organization_id
btree

Columns: organization_id

idx_courses_organization_status
btree

Columns: organization_id, status

idx_courses_start_date
btree

Columns: start_date

idx_courses_awards_certificate
btree

Columns: awards_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

valid_course_type error

Validation failed

valid_status_transition error

Validation failed

Business Rules

no_enrollment_after_deadline
on_create

New enrollments are rejected once registration_deadline has passed or the course status is not 'published'

capacity_enforcement
on_create

When max_participants is set, enrollment count from course_enrollments must not exceed it. Course-service checks current count atomically before confirming a new enrollment.

Enforced by: Course Service
cancelled_course_blocks_enrollment
always

Courses with status 'cancelled' or 'archived' reject all new sign-up attempts and suppress the sign-up button on the UI

certificate_issued_on_completion
on_update

When awards_certificate=true and a course_enrollment is marked 'completed', certificate-service automatically creates a certificates record with expiry calculated from certificate_validity_months

online_url_required_when_online
on_create

If is_online=true, online_url must not be null or empty before the course can be published

Enforced by: Course Service
tenant_scoping
always

All queries against courses are scoped to the requesting user's organization_id. Cross-organization course reads are only permitted for global admins.

enrollment_reminder_trigger
always

enrollment-reminder-scheduler reads courses with start_date within 48 hours and status='published' to dispatch reminder notifications to enrolled users

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage