core PK: id 15 required 1 unique

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.

27
Attributes
8
Indexes
11
Validation Rules
23
CRUD Operations

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
btree

Columns: organization_id

idx_events_created_by
btree

Columns: created_by

idx_events_start_date
btree

Columns: start_date

idx_events_org_start_date
btree

Columns: organization_id, start_date

idx_events_org_status
btree

Columns: organization_id, status

idx_events_local_association_id
btree

Columns: local_association_id

idx_events_recurrence_group_id
btree

Columns: recurrence_group_id

idx_events_status_start_date
btree

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
on_create

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
always

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
on_create

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
always

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
on_update

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
on_update

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.

Enforced by: Event Service
draft_events_not_visible_to_mentors
always

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
always

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
on_delete

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
always

Completed events with confirmed registrations contribute to the organization's Bufdir activity totals. Duration and participant count are aggregated for the reporting period.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage

Components Managing This Entity

service Role Guard Service ["mobile"] service Role Guard Service ["mobile","backend"] service Calendar Sync Service ["mobile"] service Calendar Sync Service ["mobile"] data Event Store ["backend"] data Event Store ["mobile"] service Event Service ["backend"] service Event Service ["mobile"] ui Event Creation Wizard ["mobile"] ui Event Creation Wizard ["mobile"] service Event Repository Service ["mobile"] service Event Repository Service ["mobile"] ui Events List Screen ["mobile"] ui Events List Screen ["mobile"] service Event Registration Service ["mobile"] service Event Registration Service ["mobile"] ui Event Registration Screen ["mobile"] ui Event Registration Screen ["mobile"] service Bufdir Report Service ["backend"] service Bufdir Report Service ["backend","mobile"] service Push Notification Service ["backend"] service Push Notification Service ["mobile","backend"] service Notification Rule Engine ["backend"] service Notification Rule Engine ["backend"] service Workshop Service ["mobile","backend"] service Workshop Service ["backend"] service Annual Summary Service ["mobile"] service Annual Summary Service ["mobile"] data Local SQLite Database ["mobile"] data Local SQLite Database ["mobile"] service Offline Manager ["mobile"] service Offline Manager ["mobile"] service Background Sync Service ["mobile"] service Background Sync Service ["mobile"] service KPI Aggregation Service ["backend"] service KPI Aggregation Service ["backend"] service Report Generation Service ["backend"] service Report Generation Service ["backend"] service Custom Report Service ["backend"] service Custom Report Service ["backend"]