core PK: id 11 required 1 unique

Description

A group activity record representing gatherings such as training sessions, group meetings, and community activities that involve multiple attendees. Events are a distinct Bufdir reporting category from individual peer mentor contacts. Can be created by peer mentors or coordinators and supports both pre-registration and post-event attendance capture.

19
Attributes
6
Indexes
10
Validation Rules
21
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Globally unique identifier for the event record
PKrequiredunique
creator_id uuid Foreign key referencing the user (peer mentor or coordinator) who created the event
required
local_association_id uuid Foreign key referencing the local association that hosts this event; scopes the event to a specific operational unit for Bufdir reporting and access control
required
title string Human-readable name describing the event (e.g., 'Monthly Group Meeting', 'Training Session: First Aid')
required
event_date datetime The calendar date on which the event takes place; stored as a date (no time component) to allow separate start_time handling
required
start_time string Scheduled start time of the event in HH:MM 24-hour format (e.g., '09:00', '14:30')
-
duration_minutes integer Duration of the event in minutes; used for Bufdir reporting totals and calendar export
required
location string Free-text description of the event venue or meeting place (e.g., 'NHF Office, Oslo', 'Zoom Meeting')
-
event_type enum Categorizes the event for Bufdir reporting and internal analytics
-
status enum Lifecycle state of the event controlling attendee registration availability and Bufdir reporting inclusion
required
description text Optional freeform description of the event agenda, purpose, or notes for attendees
-
max_attendees integer Optional capacity limit for pre-registration; if set, registration is closed once reached
-
pre_registration_enabled boolean Whether the event accepts pre-registration of expected attendees before the event occurs; if false, attendance is captured only post-event
required
attendance_confirmed boolean Whether post-event actual attendance has been finalized by the creator or coordinator; gates Bufdir reporting inclusion
required
bufdir_report_category string Bufdir-specific category label assigned to this event for grant reporting; maps to the Norwegian grant reporting taxonomy (e.g., 'gruppemøte', 'kurs', 'arrangement')
-
cancelled_at datetime Timestamp when the event was cancelled; null if not cancelled
-
cancellation_reason text Optional free-text explanation for why the event was cancelled; recorded for coordinator audit purposes
-
created_at datetime Timestamp when the event record was first persisted; set automatically on insert
required
updated_at datetime Timestamp of the most recent update to the event record; auto-updated by database trigger
required

Database Indexes

idx_event_creator_id
btree

Columns: creator_id

idx_event_local_association_id
btree

Columns: local_association_id

idx_event_event_date
btree

Columns: event_date

idx_event_status
btree

Columns: status

idx_event_local_association_date
btree

Columns: local_association_id, event_date

idx_event_local_association_status
btree

Columns: local_association_id, status

Validation Rules

title_required_non_empty error

Validation failed

event_date_required error

Validation failed

duration_positive_integer error

Validation failed

start_time_format error

Validation failed

creator_id_valid_user error

Validation failed

local_association_id_valid error

Validation failed

status_transition_valid error

Validation failed

cancellation_reason_on_cancel error

Validation failed

max_attendees_positive error

Validation failed

attendance_confirmed_requires_completed_status error

Validation failed

Business Rules

creator_role_restriction
on_create

Only users with the Peer Mentor or Coordinator role may create events; Organization Administrators and Global Administrators may create events only via the admin panel

local_association_scoping
on_create

Every event must be associated with a local association; coordinators may only create events for local associations they are assigned to via user_organization_roles

cancelled_event_no_new_attendees
on_update

Once an event's status is 'cancelled', no new attendee records (pre-registration or post-event) may be added; existing event_attendee records are retained for audit history

Enforced by: Event Service
attendance_confirmation_gates_bufdir
always

An event is included in Bufdir reporting aggregations only when attendance_confirmed is true; this prevents draft or unfinished events from distorting grant report figures

capacity_enforcement
on_create

When max_attendees is set, the system rejects new pre-registration attendees once the confirmed pre-registration count reaches max_attendees; post-event attendance confirmation is never capacity-gated

Enforced by: Event Service
distinct_bufdir_category
always

Events are reported as a distinct category in Bufdir reports separate from individual peer mentor contact activities; the report aggregation must not conflate events with individual activity records

soft_cancel_only
on_delete

Events that have any associated event_attendee records must not be hard-deleted; they must be transitioned to 'cancelled' status with a reason; only events with no attendees may be physically deleted

calendar_sync_on_create_update
on_create

When an event is created or its date/time/location is updated, the calendar integration service is notified to synchronize with any subscribed iCal feeds or native device calendars

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage

Entity Relationships

event_attendee
outgoing one_to_many

An event has many attendee records tracking registration and attendance

required cascade delete
local_association
incoming one_to_many

A local association hosts many group events within its scope

required
user
incoming one_to_many

A user (peer mentor or coordinator) creates and owns group events

required