core PK: id 9 required 1 unique

Description

Represents a scheduled group event created by coordinators or peer mentors within an organization. Events have a defined time, location, and participant capacity, and serve as the central record for the Event Management area — driving event listing, sign-up flows, and participant tracking.

16
Attributes
4
Indexes
7
Validation Rules
11
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key, generated on creation
PKrequiredunique
organization_id uuid Foreign key to organizations — enforces tenant isolation so events are scoped to a single org
required
created_by_user_id uuid Foreign key to the user (coordinator or peer mentor) who created the event
required
title string Short descriptive title of the event, shown in listings and notifications
required
description text Optional longer description of the event purpose, agenda, or notes for participants
-
location string Physical or virtual location of the event (address, room name, or video link)
-
start_datetime datetime UTC timestamp when the event starts; required for scheduling and calendar display
required
end_datetime datetime UTC timestamp when the event ends; must be after start_datetime
-
duration_minutes integer Duration of the event in minutes; derived from start/end when both are set, or set directly when end_datetime is omitted
-
status enum Lifecycle state of the event controlling visibility and sign-up eligibility
required
max_participants integer Optional cap on the number of sign-ups; null means unlimited
-
is_public_within_org boolean When true the event is visible to all org members in the listing; when false only explicitly invited users see it
required
cancellation_reason text Free-text explanation provided when an event is cancelled; stored for audit and notification context
-
cancelled_at datetime UTC timestamp when the event was cancelled; null if not cancelled
-
created_at datetime UTC timestamp of record creation; set once by the server
required
updated_at datetime UTC timestamp of last modification; updated on every write
required

Database Indexes

idx_events_organization_id
btree

Columns: organization_id

idx_events_start_datetime
btree

Columns: start_datetime

idx_events_organization_status_start
btree

Columns: organization_id, status, start_datetime

idx_events_created_by_user_id
btree

Columns: created_by_user_id

Validation Rules

start_datetime_not_in_past error

Validation failed

end_after_start error

Validation failed

title_min_length error

Validation failed

title_max_length error

Validation failed

duration_positive error

Validation failed

max_participants_positive error

Validation failed

location_max_length error

Validation failed

Business Rules

only_coordinators_create_events
on_create

Only users with Coordinator or Organization Admin roles may create or edit events; Peer Mentors may view and sign up but cannot create

published_event_required_for_signup
always

Participants may only sign up for events with status 'published'; draft and cancelled events reject sign-up attempts

max_participants_enforced_at_signup
on_create

When max_participants is set, the sign-up service rejects new event_participants records once the confirmed count reaches the cap

status_transition_guard
on_update

Status may only advance along valid paths: draft → published, draft → cancelled, published → completed, published → cancelled. Reverting from completed or jumping from draft to completed is rejected.

Enforced by: Event Service
cancellation_reason_required_when_cancelled
on_update

When status is set to 'cancelled', cancellation_reason must be non-empty so participants receive a meaningful notification

Enforced by: Event Service
notify_participants_on_cancellation
on_update

When an event is cancelled, the system emits a notification event for all confirmed event_participants so push and email notifications are dispatched

org_tenant_isolation
always

All queries against events must be scoped to the authenticated user's organization_id; cross-org access is rejected at the API layer

offline_event_creation_via_outbox
on_create

Events created offline on the mobile app are queued in the mutation outbox and synced when connectivity is restored; the local ID is remapped once the server confirms the record

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage