Event
Data Entity
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.
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
Columns: organization_id
idx_events_created_by_user_id
Columns: created_by_user_id
idx_events_starts_at
Columns: starts_at
idx_events_organization_starts_at
Columns: organization_id, starts_at
idx_events_status
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
Events are always scoped to the creating organization. Cross-org event access is never permitted.
ends_after_starts
ends_at must be strictly after starts_at. Duration is derived and stored on save.
capacity_enforcement
When max_participants is set, new sign-ups are rejected once the count of accepted event_registrations reaches the cap.
cancellation_cascades
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
Draft events are only visible to the creator and coordinators. Peer mentors can only see and sign up for published events.
completed_events_immutable
Events with status 'completed' cannot be edited. Cancellation is the only allowed transition from published.