Event
Data Entity
Description
Represents a structured group activity or gathering that peer mentors and coordinators can create, publish, and register for within the Meander platform. Events support capacity management, registration deadlines, and calendar synchronization, and serve as the data backbone for the Event Management area of the mobile app.
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Globally unique identifier for the event record, generated server-side on creation. | PKrequiredunique |
org_id |
uuid |
Foreign key to the organizations table. Enforces multi-tenant isolation — all queries must be scoped to this value. | required |
created_by_user_id |
uuid |
Foreign key to the users table identifying the peer mentor or coordinator who created the event. | required |
title |
string |
Human-readable event title displayed in listings, calendar entries, and registration screens. Must be non-empty. | required |
description |
text |
Optional freetext description providing context, agenda, or instructions for participants. | - |
event_type |
enum |
Classifies the type of event for reporting, filtering, and Bufdir field mapping. | required |
location_name |
string |
Human-readable venue or location name (e.g. 'Blindeforbundet, Oslo kontor'). Optional for virtual events. | - |
address |
string |
Street address of the event location for navigation and calendar entry population. | - |
start_datetime |
datetime |
UTC timestamp of when the event begins. Required for calendar sync, registration deadline enforcement, and listing sort order. | required |
end_datetime |
datetime |
UTC timestamp of when the event ends. Must be after start_datetime when provided. Used to compute duration for calendar exports. | - |
duration_minutes |
integer |
Explicit event duration in minutes. Stored separately from end_datetime to support events where exact end time is unknown but estimated duration is set. | - |
max_capacity |
integer |
Maximum number of registrants allowed. NULL means unlimited. Used by registration service to enforce capacity before confirming sign-ups. | - |
registration_deadline |
datetime |
UTC cutoff after which new registrations are blocked. Must be before start_datetime when provided. | - |
status |
enum |
Lifecycle state of the event. Controls visibility in listings and ability to register. Draft events are only visible to the creator and coordinators. | required |
is_public |
boolean |
When true, the event is visible to all org members in the listing. When false, only coordinator and invited users can see it. | required |
cancellation_reason |
text |
Optional freetext reason provided when status transitions to 'cancelled'. Surfaced in push notifications sent to registered participants. | - |
registration_count |
integer |
Denormalized count of confirmed event_registrations rows for this event. Updated atomically alongside registration inserts to support fast capacity checks without a JOIN. | required |
created_at |
datetime |
UTC timestamp of record creation. Set once on insert, never updated. | required |
updated_at |
datetime |
UTC timestamp of the most recent update to this record. Updated on every mutation for cache invalidation and sync detection. | required |
Database Indexes
idx_event_org_start
Columns: org_id, start_datetime
idx_event_org_status
Columns: org_id, status
idx_event_creator
Columns: created_by_user_id
idx_event_status_start
Columns: status, start_datetime
idx_event_updated_at
Columns: org_id, updated_at
Validation Rules
title_not_empty
error
Validation failed
start_datetime_future_on_create
error
Validation failed
end_after_start
error
Validation failed
registration_deadline_before_start
error
Validation failed
max_capacity_positive
error
Validation failed
org_id_matches_caller
error
Validation failed
cancellation_requires_reason_on_published
warning
Validation failed
registration_count_non_negative
error
Validation failed
Business Rules
tenant_isolation
Every query against the events table must include an org_id WHERE clause matching the authenticated user's organization. Cross-organization event reads are forbidden for all roles except Global Admin system-level operations.
coordinator_create_only
Only users with Coordinator or Org Admin role may create events. Peer Mentors can view and register for events but cannot create them.
capacity_enforcement
When max_capacity is set, new event_registrations must be blocked once registration_count reaches max_capacity. The registration_count column is incremented atomically in the same transaction as the event_registrations insert to prevent race conditions.
registration_deadline_enforcement
If registration_deadline is set and the current UTC time is past that value, new registrations are rejected with a deadline-passed error. The check is performed server-side on the registration endpoint.
cancellation_notification
When an event's status transitions from 'published' to 'cancelled', a push notification must be dispatched to all confirmed registrants. The cancellation_reason field is included in the notification body.
status_transition_guard
Valid status transitions are: draft→published, draft→cancelled, published→cancelled, published→completed. Reverse transitions (e.g. cancelled→published) are forbidden. completed events are immutable.
calendar_sync_propagation
When an event's start_datetime, end_datetime, location_name, or title changes, the Calendar Sync Service must be triggered to push the update to any external calendars that have synced this event.
draft_visibility_restriction
Events with status='draft' are excluded from the public events listing returned to Peer Mentors. Only the creating coordinator and org admins can see draft events.