configuration PK: id 12 required 2 unique

Description

Stores per-user notification channel preferences and opt-in/opt-out settings for the Meander platform, controlling which channels (push, email, SMS, in-app) deliver alerts and which notification scenario types are active for each user.

15
Attributes
2
Indexes
5
Validation Rules
10
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key, generated at row creation.
PKrequiredunique
user_id uuid FK to users — the user whose notification preferences this row represents. Enforces one settings row per user via a UNIQUE constraint.
requiredunique
organization_id uuid FK to organizations — tenant isolation scope. Captures the user's primary organization at row creation time.
required
push_enabled boolean Global master switch for push notifications. When false, no push alerts are dispatched regardless of scenario-level overrides.
required
email_enabled boolean Global master switch for email notifications. When false, no email alerts are dispatched regardless of scenario-level overrides.
required
sms_enabled boolean Global master switch for SMS notifications. Defaults to false — users must explicitly opt in to SMS channel.
required
in_app_enabled boolean Controls whether the in-app notification inbox is active. When false, the inbox badge and unread count are suppressed; notifications may still be stored server-side.
required
scenario_overrides json Per-scenario-type channel overrides, keyed by scenario_type string (e.g. 'assignment_dispatch', 'expense_approval', 'event_reminder', 'certificate_expiry'). Each entry: {push: bool, email: bool, sms: bool}. Missing keys inherit the global channel toggles. Overrides can only further restrict — never expand — global toggles.
-
quiet_hours_enabled boolean Whether the user has activated a do-not-disturb window. When true, push notifications falling inside the quiet window are deferred until quiet_hours_end.
required
quiet_hours_start string Start of the quiet/do-not-disturb window in HH:MM 24-hour local time (e.g. '22:00'). Required when quiet_hours_enabled is true; null otherwise.
-
quiet_hours_end string End of the quiet/do-not-disturb window in HH:MM 24-hour local time (e.g. '07:00'). May cross midnight. Required when quiet_hours_enabled is true; null otherwise.
-
digest_mode enum Controls email/SMS batching behavior for non-urgent notifications. 'immediate' sends as events occur; 'daily' batches into one digest per day.
required
language enum Preferred language for notification subject lines, body text, and SMS messages. Defaults to Norwegian Bokmål.
required
created_at datetime Timestamp when the settings row was first created, typically during user onboarding account activation.
required
updated_at datetime Timestamp of the most recent settings change. Auto-updated on every write from the Notification Settings Screen or sync service.
required

Database Indexes

idx_notification_settings_user_id
btree unique

Columns: user_id

idx_notification_settings_organization_id
btree

Columns: organization_id

Validation Rules

quiet_hours_both_times_required error

Validation failed

quiet_hours_time_format error

Validation failed

language_is_supported_locale error

Validation failed

scenario_overrides_valid_structure error

Validation failed

user_id_references_active_user error

Validation failed

Business Rules

one_settings_row_per_user
on_create

Each user has exactly one notification_settings row. The row is created automatically at account activation with platform defaults. Attempting to insert a second row for the same user_id must be rejected by the UNIQUE constraint.

Enforced by: notification_settings
global_channel_gate_supersedes_overrides
always

When a global channel toggle (push_enabled, email_enabled, sms_enabled) is false, the notification-event-bus must not dispatch to that channel even if a scenario_override entry explicitly enables it. The global toggle is the irrevocable master switch.

quiet_hours_defer_push
always

When quiet_hours_enabled is true and the current wall-clock time (in the user's device timezone) falls within the quiet window, push notifications are deferred and batched for delivery at quiet_hours_end. Urgent scenario types (e.g. assignment_dispatch from the encrypted-assignments area) bypass quiet hours and are delivered immediately.

scenario_override_restriction_only
always

scenario_overrides entries can only restrict channels that are globally enabled — they cannot grant a channel that is globally disabled. Effective channel = global_toggle AND scenario_override.

Enforced by: Notification Event Bus
settings_created_on_user_activation
on_create

A notification_settings row with platform defaults must be inserted the moment a new user activates their account. No notification dispatch path may handle a missing settings row — its absence is always a data integrity error.

Enforced by: notification_settings
offline_sync_mandatory
on_update

Any settings changes made offline (e.g. via the Notification Settings Screen while on airplane mode) must be queued and synced to the backend by notification-settings-sync-service as soon as connectivity is restored. The backend copy is authoritative for dispatch decisions; stale local-only settings must never gate server-side dispatch.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage