Events
Data Entity
Description
Represents structured group activities such as meetings, training sessions, social gatherings, and workshops created by peer mentors or coordinators within an organization. Events support sign-up, capacity tracking, and serve as the foundation for group-based activity reporting and Bufdir compliance.
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Unique identifier for the event | PKrequiredunique |
title |
string |
Human-readable event title displayed in listings and detail views | required |
description |
text |
Detailed event description including agenda and purpose | - |
event_type |
enum |
Category of event for reporting and filtering | required |
status |
enum |
Current lifecycle state of the event | required |
created_by |
uuid |
Foreign key to the user who created the event | required |
organization_id |
uuid |
Foreign key to the owning organization for multi-tenant isolation | required |
local_association_id |
uuid |
Foreign key to the local association hosting the event, used for scoping visibility | - |
start_date |
datetime |
Event start date and time in UTC | required |
end_date |
datetime |
Event end date and time in UTC | required |
duration_minutes |
integer |
Computed or explicit duration in minutes, used for Bufdir reporting aggregation | required |
location |
string |
Physical address or venue name for the event | - |
is_virtual |
boolean |
Whether the event is held online rather than at a physical location | required |
virtual_meeting_url |
string |
URL for virtual meeting room when is_virtual is true | - |
max_participants |
integer |
Maximum number of registrations allowed, null means unlimited | - |
registration_deadline |
datetime |
Deadline for event sign-up, defaults to event start_date if not set | - |
requires_approval |
boolean |
Whether registrations require coordinator approval before confirmation | required |
is_recurring |
boolean |
Whether this event is part of a recurring series | required |
recurrence_rule |
json |
iCal RRULE-style recurrence configuration when is_recurring is true | - |
recurrence_group_id |
uuid |
Groups recurring event instances together for bulk operations | - |
visibility |
enum |
Controls who can see the event in listings | required |
tags |
json |
Array of free-form tags for filtering and categorization | - |
notes |
text |
Internal notes visible only to the event creator and coordinators | - |
cancelled_at |
datetime |
Timestamp when the event was cancelled, null if active | - |
cancelled_reason |
string |
Reason for cancellation, required when status changes to cancelled | - |
created_at |
datetime |
Timestamp of event record creation | required |
updated_at |
datetime |
Timestamp of last modification | required |
Database Indexes
idx_events_organization_id
Columns: organization_id
idx_events_created_by
Columns: created_by
idx_events_start_date
Columns: start_date
idx_events_org_start_date
Columns: organization_id, start_date
idx_events_org_status
Columns: organization_id, status
idx_events_local_association_id
Columns: local_association_id
idx_events_recurrence_group_id
Columns: recurrence_group_id
idx_events_status_start_date
Columns: status, start_date
Validation Rules
title_not_blank
error
Validation failed
start_date_in_future
error
Validation failed
duration_positive_and_reasonable
error
Validation failed
virtual_meeting_url_required_when_virtual
warning
Validation failed
max_participants_positive
error
Validation failed
organization_id_exists
error
Validation failed
created_by_user_exists
error
Validation failed
cancelled_reason_required_on_cancel
error
Validation failed
valid_status_transitions
error
Validation failed
recurrence_rule_valid_when_recurring
error
Validation failed
registration_deadline_before_start
error
Validation failed
Business Rules
creator_must_have_event_creation_role
Only users with Peer Mentor or Coordinator role within the organization can create events. Role Guard Service validates the creator's role and organization membership before event creation proceeds.
organization_tenant_isolation
All event queries must be scoped to the requesting user's organization_id. Coordinators see events within their local association and organization. Peer mentors see published events they are eligible to attend.
end_date_after_start_date
Event end_date must be strictly after start_date. Duration is computed as the difference or validated against the explicit duration_minutes field.
capacity_enforcement
When max_participants is set, the system must reject new registrations once the confirmed registration count reaches the limit. Checked at registration time, not at event creation.
cancellation_notifies_registrants
When an event status transitions to cancelled, all registered participants must receive a push notification and optionally an email notification about the cancellation.
published_events_immutable_past
Published events with a start_date in the past cannot have their start_date, end_date, or location modified. They can only transition to completed or have notes updated.
draft_events_not_visible_to_mentors
Events in draft status are only visible to the creator and coordinators within the same organization. Peer mentors cannot see draft events in their listings.
registration_deadline_enforcement
If registration_deadline is set, new sign-ups are rejected after the deadline passes. If not set, registration closes at event start_date.
soft_delete_on_cancel
Events are never physically deleted. Cancellation sets status to cancelled, populates cancelled_at and cancelled_reason, and preserves all registration data for audit and reporting.
event_counts_toward_bufdir_reporting
Completed events with confirmed registrations contribute to the organization's Bufdir activity totals. Duration and participant count are aggregated for the reporting period.