Event Participant
Data Entity
Description
Join entity linking users or contacts to events they participated in, enabling participant count aggregation for Bufdir reporting and coordinator oversight of group activity attendance.
Data Structure
| Name | Type | Description | Constraints |
|---|---|---|---|
id |
uuid |
Primary key, auto-generated UUID for each participant entry | PKrequiredunique |
event_id |
uuid |
Foreign key referencing the events table; the event this participant entry belongs to | required |
user_id |
uuid |
Foreign key referencing the users table; the registered app user who participated. Null if participant is a non-user contact. | - |
contact_id |
uuid |
Foreign key referencing the contacts table; a non-user contact who participated in the event. Null if participant is a registered user. | - |
added_at |
datetime |
Timestamp (UTC) when this participant entry was created, used for audit trail and coordinator oversight | required |
added_by_user_id |
uuid |
Foreign key referencing the user who added this participant (may be a coordinator or the peer mentor who created the event) | required |
attendance_confirmed |
boolean |
Whether attendance at the event has been explicitly confirmed, as opposed to pre-registered. Used for accurate Bufdir participant count aggregation. | required |
attendance_confirmed_at |
datetime |
Timestamp (UTC) when attendance was confirmed; null if not yet confirmed | - |
role_at_event |
enum |
The participant's role at the event (attendee, facilitator, observer). Defaults to attendee for standard Bufdir participant counting. | required |
notes |
text |
Optional coordinator or peer mentor notes about this participant's attendance (e.g., arrived late, special accommodations) | - |
organization_id |
uuid |
Organization scope for RLS enforcement; derived from the parent event but stored for fast RLS query performance | required |
Database Indexes
idx_event_participants_event_id
Columns: event_id
idx_event_participants_user_id
Columns: user_id
idx_event_participants_contact_id
Columns: contact_id
idx_event_participants_event_user
Columns: event_id, user_id
idx_event_participants_event_contact
Columns: event_id, contact_id
idx_event_participants_org_id
Columns: organization_id
idx_event_participants_attendance_confirmed
Columns: event_id, attendance_confirmed
Validation Rules
exactly_one_of_user_id_or_contact_id_required
error
Validation failed
event_id_must_reference_existing_event
error
Validation failed
user_id_must_reference_existing_user
error
Validation failed
contact_id_must_reference_existing_contact
error
Validation failed
added_at_cannot_be_future
error
Validation failed
role_at_event_must_be_valid_enum
error
Validation failed
notes_max_length
error
Validation failed
attendance_confirmed_at_requires_confirmed_flag
error
Validation failed
Business Rules
participant_requires_user_or_contact
Every event_participants record must reference either a user_id or a contact_id, but not both. A participant cannot be anonymous nor double-linked.
no_duplicate_user_participant_per_event
A given user_id can appear at most once per event_id. Prevents double-counting the same registered user in Bufdir participant totals.
no_duplicate_contact_participant_per_event
A given contact_id can appear at most once per event_id. Prevents double-counting the same contact in Bufdir participant totals.
only_confirmed_participants_count_for_bufdir
Bufdir report aggregations count only participant entries where attendance_confirmed = true. Pre-registered but unconfirmed participants are excluded from grant reporting.
organization_scope_must_match_event
The organization_id on an event_participants record must match the organization_id of the parent event. Prevents cross-organization data leakage.
rls_scoped_to_organization
Supabase RLS policies restrict read and write access to event_participants records within the authenticated user's organization scope. Coordinators can access all participants in their org; peer mentors only for events they created.
cascade_delete_on_event_removal
When a parent event is deleted, all associated event_participants records are cascade-deleted to maintain referential integrity.
CRUD Operations
Storage Configuration
Entity Relationships
Event participants may be linked to contact records for non-user attendees
Each participant entry may link to a registered user who attended the event
An event records multiple participant attendance entries for Bufdir participant counting