core PK: id 9 required 1 unique

Description

Records the enrollment of a user (peer mentor or coordinator) in a training course. Acts as the join table between users and courses, tracking the full lifecycle from registration through completion, including attendance confirmation, cancellation, proxy registration by coordinators, and linkage to issued certifications.

19
Attributes
7
Indexes
7
Validation Rules
19
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Unique identifier for the registration record
PKrequiredunique
course_id uuid Foreign key referencing the course being registered for
required
user_id uuid Foreign key referencing the user (peer mentor or coordinator) who is enrolled
required
organization_id uuid Organization context for multi-tenant scoping and Bufdir reporting
required
status enum Current lifecycle state of the registration
required
registered_at datetime Timestamp when the registration was created
required
confirmed_at datetime Timestamp when the registration was confirmed (capacity secured)
-
cancelled_at datetime Timestamp when the registration was cancelled
-
completed_at datetime Timestamp when the user completed the course
-
no_show_recorded_at datetime Timestamp when a no-show was recorded by the facilitator
-
attendance_confirmed boolean Whether the facilitator has confirmed the user attended the course session
required
cancellation_reason text Free-text reason provided when the registration is cancelled
-
proxy_registered_by uuid User ID of the coordinator who registered on behalf of the user; null if self-registered
-
waitlist_position integer Position in the waitlist queue when status is waitlisted; null otherwise
-
certification_id uuid Foreign key to the certification record issued upon course completion; null until completion triggers issuance
-
reminder_sent_at datetime Timestamp of the last pre-course reminder notification dispatched to the user
-
notes text Optional internal notes added by a coordinator about this registration
-
created_at datetime Record creation timestamp
required
updated_at datetime Record last-updated timestamp
required

Database Indexes

idx_course_registration_user_course_unique
btree unique

Columns: user_id, course_id

idx_course_registration_course_id
btree

Columns: course_id

idx_course_registration_user_id
btree

Columns: user_id

idx_course_registration_organization_id
btree

Columns: organization_id

idx_course_registration_status
btree

Columns: status

idx_course_registration_org_status
btree

Columns: organization_id, status

idx_course_registration_certification_id
btree

Columns: certification_id

Validation Rules

course_id_references_active_course error

Validation failed

user_id_references_active_user error

Validation failed

valid_status_transition error

Validation failed

completed_at_requires_attendance_confirmed error

Validation failed

waitlist_position_only_when_waitlisted error

Validation failed

certification_id_only_on_completion error

Validation failed

proxy_registered_by_must_be_coordinator error

Validation failed

Business Rules

no_duplicate_enrollment
on_create

A user may only have one active registration per course. Attempting to register again when an active (pending, confirmed, waitlisted) registration exists must be rejected.

capacity_check_on_registration
on_create

When a user registers for a course that has reached its maximum participant capacity, the registration status must be set to 'waitlisted' rather than 'confirmed'. The waitlist_position is assigned sequentially.

waitlist_promotion_on_cancellation
on_update

When a confirmed registration is cancelled, the next waitlisted registration for the same course must be automatically promoted to 'confirmed' and waitlist_position cleared. A confirmation notification must be dispatched.

completion_triggers_certification_check
on_update

When status transitions to 'completed' and attendance_confirmed is true, the Certificate Service must evaluate whether the course maps to a certification_type and issue a certification record if applicable. The certification_id must be linked back.

proxy_registration_scope_enforcement
on_create

A coordinator may only register on behalf of users (proxy_registered_by set) within their own local association scope. Cross-association proxy registration must be rejected.

cancellation_reason_required
on_update

When a registration is cancelled, a cancellation_reason must be provided. Cancellations without a reason must be rejected.

tenant_isolation
always

All queries against course_registrations must include an organization_id filter to enforce multi-tenant data isolation. No cross-organization reads are permitted.

pre_course_reminder_dispatch
on_update

For each confirmed registration, a pre-course reminder notification must be scheduled and dispatched. reminder_sent_at must be updated after dispatch to prevent duplicate delivery.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage