configuration PK: id 17 required 2 unique

Description

Stores per-user configuration controlling which notification types and delivery channels are enabled. Acts as the authoritative gate checked by the scenario engine and delivery services before dispatching any notification.

19
Attributes
1
Indexes
4
Validation Rules
10
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key
PKrequiredunique
user_id uuid FK to users. One record per user.
requiredunique
push_enabled boolean Master toggle for push notifications to this user's registered devices.
required
email_enabled boolean Master toggle for email notification delivery.
required
sms_enabled boolean Master toggle for SMS notification delivery.
required
activity_reminders boolean Whether the user receives reminders to log activities after a period of inactivity.
required
assignment_notifications boolean Whether the user receives notifications when a new encrypted assignment is dispatched to them.
required
assignment_reminder_notifications boolean Whether the user receives follow-up reminders for unacknowledged assignments after 10 days.
required
event_notifications boolean Whether the user receives notifications for new events and event sign-up confirmations.
required
expense_status_notifications boolean Whether the user receives notifications when an expense claim is approved, rejected, or requires action.
required
certification_expiry_notifications boolean Whether the user receives advance warnings when their peer mentor certificate is approaching expiry.
required
coordinator_team_notifications boolean Coordinator-only: whether to receive notifications about team activity (flagged activities, approval queues, threshold alerts).
required
marketing_notifications boolean Whether the user opts in to non-operational communications such as feature announcements and newsletters.
required
quiet_hours_enabled boolean If true, push notifications are suppressed during the defined quiet window.
required
quiet_hours_start string Local time (HH:MM, 24h) at which the quiet window begins. Null when quiet_hours_enabled is false.
-
quiet_hours_end string Local time (HH:MM, 24h) at which the quiet window ends. Null when quiet_hours_enabled is false.
-
preferred_language enum Language for notification content. Defaults to the user's app locale.
required
created_at datetime Record creation timestamp (UTC).
required
updated_at datetime Last modification timestamp (UTC). Updated on every preference change.
required

Database Indexes

idx_notification_preferences_user_id
btree unique

Columns: user_id

Validation Rules

valid_quiet_hours_format error

Validation failed

quiet_hours_range_not_zero error

Validation failed

preferred_language_in_allowed_set error

Validation failed

user_id_references_existing_user error

Validation failed

Business Rules

one_record_per_user
on_create

Exactly one notification_preferences row must exist per user. Created automatically upon user account provisioning; never duplicated.

channel_gate_before_dispatch
always

Before dispatching any notification, the scenario engine must read this record and skip delivery on disabled channels. If push_enabled is false, no push is sent regardless of scenario configuration.

quiet_hours_requires_both_times
on_update

If quiet_hours_enabled is true, both quiet_hours_start and quiet_hours_end must be present and valid. If either is missing the preference is treated as disabled.

coordinator_flag_advisory_only
always

coordinator_team_notifications is stored for all user roles but only acted upon when the user holds a Coordinator or Org Admin role. The scenario engine skips this preference for Peer Mentor role users.

marketing_opt_in_default_off
on_create

marketing_notifications must default to false in compliance with Norwegian marketing regulations (Markedsføringsloven §15). Explicit opt-in required.

delete_on_user_deletion
on_delete

Preferences record is cascade-deleted when the parent user account is deleted. No orphan rows permitted.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage