configuration PK: id 14 required 2 unique

Description

Per-user configuration record controlling which notification channels are active, when notifications may be delivered (quiet hours), and per-scenario type toggles. One record exists per user, created automatically at registration and updated through the Notification Settings screen.

16
Attributes
2
Indexes
5
Validation Rules
11
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Surrogate primary key generated server-side (UUID v4).
PKrequiredunique
user_id uuid Foreign key to users. Enforces the one-to-one relationship; each user has exactly one notification settings record.
requiredunique
push_enabled boolean Global toggle for FCM push delivery. When false, no push notifications are dispatched for this user regardless of scenario rules.
required
email_enabled boolean Global toggle for transactional email delivery. When false, no email notifications are dispatched for this user.
required
sms_enabled boolean Global toggle for SMS delivery via SMS gateway. Defaults false; user must explicitly opt in.
required
quiet_hours_enabled boolean When true, push notifications are suppressed during the window defined by quiet_hours_start / quiet_hours_end. Non-push channels are unaffected.
required
quiet_hours_start string Local wall-clock time at which the quiet period begins, stored as HH:MM (24-hour). Null when quiet_hours_enabled is false.
-
quiet_hours_end string Local wall-clock time at which the quiet period ends, stored as HH:MM (24-hour). May be earlier than quiet_hours_start to represent an overnight window (e.g. 22:00–07:00).
-
digest_frequency enum Controls whether non-urgent notifications are delivered immediately or batched into a daily or weekly digest.
required
activity_reminder_enabled boolean Controls delivery of scenario-triggered reminders related to activity registration (e.g. 'You haven't logged an activity in 7 days').
required
assignment_alert_enabled boolean Controls delivery of encrypted-assignment dispatch and reminder notifications.
required
event_notification_enabled boolean Controls delivery of event sign-up confirmations, reminders, and changes.
required
expense_update_enabled boolean Controls delivery of expense claim status change notifications (approved, rejected, pending review).
required
system_alert_enabled boolean Controls delivery of platform-level system alerts (maintenance windows, security notices). Cannot be permanently disabled — only suppressed during quiet hours.
required
created_at datetime Timestamp of record creation, set automatically when the user account is provisioned.
required
updated_at datetime Timestamp of last update, maintained by the service layer on every write.
required

Database Indexes

idx_notification_settings_user_id
btree unique

Columns: user_id

idx_notification_settings_quiet_hours
btree

Columns: quiet_hours_enabled, quiet_hours_start, quiet_hours_end

Validation Rules

quiet_hours_format_HH_MM error

Validation failed

digest_frequency_enum_values error

Validation failed

digest_frequency_enum_values_on_update error

Validation failed

user_id_references_existing_user error

Validation failed

quiet_hours_null_when_disabled info

Validation failed

Business Rules

auto_create_on_user_provision
on_create

A notification_settings record with all defaults is created automatically when a user account is provisioned. Users must never reach the Notification Settings screen without an existing record.

one_record_per_user
on_create

Exactly one notification_settings record may exist per user_id. The unique constraint on user_id enforces this at the database level; the service layer must upsert rather than insert if a race condition is possible.

quiet_hours_requires_both_bounds
on_update

If quiet_hours_enabled is true, both quiet_hours_start and quiet_hours_end must be non-null and valid HH:MM strings. Enabling quiet hours without both bounds is rejected.

overnight_quiet_window_supported
always

quiet_hours_end may be numerically earlier than quiet_hours_start to represent an overnight window (e.g. 22:00 → 07:00). The dispatch layer checks whether the current UTC-converted local time falls within the window using modulo arithmetic.

system_alerts_bypass_quiet_hours
always

Notifications classified as system_alert severity always bypass quiet_hours suppression. The user may toggle system_alert_enabled off to suppress non-urgent system messages, but critical security alerts are always delivered immediately.

channel_toggle_propagates_to_dispatch
on_update

When push_enabled, email_enabled, or sms_enabled is updated, the change takes effect immediately for all future dispatch decisions. In-flight notifications already queued are not recalled.

settings_cached_in_scenario_engine
on_update

The scenario rules engine caches notification_settings per user to avoid per-notification DB reads at high throughput. Cache is invalidated on any update to this record.

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage