core PK: id 11 required 1 unique

Description

A structured group event created by peer mentors or coordinators, with sign-up tracking and attendance management. Events represent scheduled group activities distinct from individual peer mentor activities.

16
Attributes
5
Indexes
5
Validation Rules
14
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key
PKrequiredunique
organization_id uuid Owning organization (tenant isolation)
required
created_by_user_id uuid User who created the event (peer mentor or coordinator)
required
title string Event title/name
required
description text Optional longer description or agenda for the event
-
location string Physical or virtual location of the event
-
starts_at datetime Event start date and time (UTC)
required
ends_at datetime Event end date and time (UTC)
required
duration_minutes integer Duration in minutes (derived from starts_at/ends_at, stored for query efficiency)
required
max_participants integer Maximum number of sign-ups allowed; null means unlimited
-
status enum Lifecycle state of the event
required
is_public boolean Whether the event is visible to all org members or only to invitees
required
cancellation_reason text Reason provided when event is cancelled
-
metadata json Extensible key-value bag for org-specific event attributes (e.g. meeting link, accessibility notes)
-
created_at datetime Record creation timestamp (UTC)
required
updated_at datetime Last update timestamp (UTC)
required

Database Indexes

idx_events_organization_id
btree

Columns: organization_id

idx_events_created_by_user_id
btree

Columns: created_by_user_id

idx_events_starts_at
btree

Columns: starts_at

idx_events_organization_starts_at
btree

Columns: organization_id, starts_at

idx_events_status
btree

Columns: status

Validation Rules

title_required error

Validation failed

starts_at_not_in_past error

Validation failed

max_participants_positive error

Validation failed

cancellation_reason_required_on_cancel error

Validation failed

duration_consistency error

Validation failed

Business Rules

tenant_isolation
always

Events are always scoped to the creating organization. Cross-org event access is never permitted.

ends_after_starts
on_create

ends_at must be strictly after starts_at. Duration is derived and stored on save.

capacity_enforcement
always

When max_participants is set, new sign-ups are rejected once the count of accepted event_registrations reaches the cap.

cancellation_cascades
on_update

When an event is cancelled, all pending event_registrations are transitioned to 'cancelled' and push notifications are sent to registered users.

only_published_events_visible
always

Draft events are only visible to the creator and coordinators. Peer mentors can only see and sign up for published events.

completed_events_immutable
on_update

Events with status 'completed' cannot be edited. Cancellation is the only allowed transition from published.

Enforced by: EventService

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage