Event
Data Entity
Description
Structured events created by peer mentors and coordinators within an organization. Events have a defined time, location, and capacity, and support participant sign-ups. Used for group meetings, training sessions, social gatherings, and career workshops. Linked to the Event Management area (MVP).
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Primary key. Client-generated UUID to support offline-first creation via the mutation outbox. | PKrequiredunique |
organization_id |
uuid |
Foreign key to organizations. Enforces tenant isolation — events are scoped to a single organization. | required |
created_by_user_id |
uuid |
Foreign key to users. The peer mentor or coordinator who created the event. Used for ownership checks and audit. | required |
title |
string |
Human-readable name for the event. Displayed on the events list and detail screens. | required |
description |
text |
Optional free-text description of the event's purpose, agenda, or other details. | - |
event_type |
enum |
Categorizes the event for filtering, statistics, and Bufdir reporting alignment. | required |
start_datetime |
datetime |
UTC timestamp for when the event begins. Stored as timezone-aware timestamp; displayed in the user's local timezone on device. | required |
end_datetime |
datetime |
UTC timestamp for when the event ends. Must be strictly after start_datetime. | - |
duration_minutes |
integer |
Explicit duration in minutes. When end_datetime is absent, this field defines event length. Defaults to 60 if neither end_datetime nor duration_minutes is set. | - |
location |
string |
Human-readable location string (address, venue name, or video link). Not geocoded at MVP. | - |
location_type |
enum |
Indicates how the event is hosted, used for display and accessibility planning. | required |
max_participants |
integer |
Optional cap on the number of participants who can sign up. NULL means unlimited. Enforced at sign-up time by event-sign-up-service. | - |
is_public |
boolean |
When true, all users within the organization can see and sign up for the event. When false, only explicitly invited users or the creator can see it. | required |
status |
enum |
Lifecycle state of the event. Controls visibility and editability. Draft events are not visible to other users. | required |
cancellation_reason |
text |
Optional reason provided when status is set to cancelled. Surfaced on the event detail screen. | - |
created_at |
datetime |
UTC timestamp of record creation. Set server-side on insert. | required |
updated_at |
datetime |
UTC timestamp of last update. Maintained by a database trigger or ORM hook. | required |
deleted_at |
datetime |
Soft-delete timestamp. NULL means active. Non-null means logically deleted. All queries filter WHERE deleted_at IS NULL by default. | - |
Database Indexes
idx_events_organization_id
Columns: organization_id
idx_events_created_by_user_id
Columns: created_by_user_id
idx_events_start_datetime
Columns: start_datetime
idx_events_org_start
Columns: organization_id, start_datetime
idx_events_org_status
Columns: organization_id, status
idx_events_deleted_at
Columns: deleted_at
Validation Rules
title_required_nonempty
error
Validation failed
start_datetime_not_in_past
error
Validation failed
end_after_start
error
Validation failed
duration_positive
error
Validation failed
max_participants_positive
error
Validation failed
cancellation_reason_on_cancel
warning
Validation failed
valid_organization_membership
error
Validation failed
Business Rules
tenant_isolation
Every event must belong to exactly one organization. All reads and writes are scoped by organization_id derived from the authenticated user's session. Cross-organization event access is forbidden.
creator_ownership
Peer mentors may only edit or soft-delete events they created (created_by_user_id matches their user ID). Coordinators may edit or cancel any event within their organization.
no_reopen_cancelled
Once an event's status is set to 'cancelled', it cannot be transitioned back to 'published' or 'draft'. A new event must be created instead.
auto_complete_past_events
Events whose end_datetime (or start_datetime + duration_minutes) has passed and whose status is 'published' are transitioned to 'completed' by a background job or lazily on next read.
capacity_enforcement
When max_participants is set, sign-ups are rejected once event_participants count equals max_participants. Race conditions handled via SELECT FOR UPDATE in the sign-up transaction.
audit_on_cancellation
Cancelling an event writes an audit log entry including the cancellation_reason and the acting user's ID, for Bufdir compliance and organization oversight.
notify_participants_on_cancel
When an event's status changes to 'cancelled', all signed-up participants receive a push notification (and email/SMS if configured) informing them of the cancellation.
module_toggle_gate
Event creation, listing, and sign-up endpoints are only accessible when the 'event-management' module is enabled for the user's organization. Disabled module returns 403.