core PK: id 6 required 2 unique

Description

Tracks the operational status of a peer mentor — whether they are active, paused, or auto-paused due to certification expiry. One record per user, updated as status transitions occur.

12
Attributes
3
Indexes
4
Validation Rules
10
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key
PKrequiredunique
user_id uuid FK to users table — the peer mentor this status record belongs to
requiredunique
status enum Current operational status of the peer mentor
required
paused_at datetime Timestamp when the peer mentor manually paused their availability
-
paused_reason text Optional free-text reason provided by the peer mentor when pausing
-
auto_paused_at datetime Timestamp when the system automatically paused the mentor due to certification expiry
-
auto_pause_reason enum System-set reason for auto-pause trigger
-
resumed_at datetime Timestamp of most recent resume from paused state
-
coordinator_notified_at datetime Timestamp when coordinator was last notified of a status change
-
visible_on_org_website boolean Whether the peer mentor is currently shown on the organization's public-facing peer mentor listings. Set to false when paused or auto-paused.
required
created_at datetime Record creation timestamp
required
updated_at datetime Last modification timestamp
required

Database Indexes

idx_peer_mentor_statuses_user_id
btree unique

Columns: user_id

idx_peer_mentor_statuses_status
btree

Columns: status

idx_peer_mentor_statuses_auto_paused_at
btree

Columns: auto_paused_at

Validation Rules

valid_status_transition error

Validation failed

paused_at_set_on_pause error

Validation failed

resumed_at_set_on_resume error

Validation failed

user_must_be_peer_mentor error

Validation failed

Business Rules

one_status_per_user
on_create

Each user has exactly one peer_mentor_statuses record. Created when a user is assigned the Peer Mentor role; never deleted, only updated.

coordinator_notification_on_pause
on_update

When a peer mentor pauses, the assigned coordinator must be notified via push/email notification. coordinator_notified_at is set on successful dispatch.

visibility_follows_status
on_update

visible_on_org_website is automatically set to false when status transitions to paused or auto_paused, and restored to true on resume.

auto_pause_on_certification_expiry
on_update

CertificationExpiryChecker transitions status to auto_paused when the peer mentor's certificate expires. Sets auto_paused_at and auto_pause_reason.

resume_requires_valid_certification
on_update

A peer mentor in auto_paused state cannot resume until they hold a valid (non-expired) certificate. ResumeStatusService validates certificate status before allowing transition.

manual_pause_overrides_active_only
on_update

Peer mentors can only manually pause from active status. An auto_paused mentor cannot be manually paused again — the auto-pause state must be resolved through certification renewal.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage