configuration PK: id 7 required 2 unique

Description

Per-user configuration record that controls which notification categories a user receives and through which delivery channels (push, email, SMS). Enforces GDPR opt-out rights and drives channel routing decisions in the notification rule engine. Maintained as a one-to-one relationship with the users table.

9
Attributes
2
Indexes
5
Validation Rules
12
CRUD Operations

Data Structure

Name Type Description Constraints
id uuid Primary key, generated on record creation
PKrequiredunique
user_id uuid Foreign key to users table. Enforces one-to-one relationship — each user has exactly one notification settings record
requiredunique
push_enabled boolean Master toggle for all push notification delivery. When set to false, all FCM/APNs tokens for this user must be revoked and no push notifications are delivered regardless of per-category settings
required
email_enabled boolean Master toggle for all email notification delivery. When false, email notifications are suppressed regardless of per-category settings
required
sms_enabled boolean Master toggle for all SMS notification delivery. When false, SMS notifications are suppressed regardless of per-category settings
required
preferences json JSONB map of per-category per-channel preferences. Structure: { 'assignments': { 'push': bool, 'email': bool, 'sms': bool }, 'activities': { ... }, 'events': { ... }, 'expenses': { ... }, 'certificates': { ... }, 'reminders': { ... } }. Absence of a key means the master toggle applies. Stored as JSONB for indexable partial updates via PATCH.
-
gdpr_consent_recorded_at datetime Timestamp when the user last explicitly confirmed or updated their notification consent. Required for GDPR Article 7 consent traceability. Null means default preferences were never explicitly confirmed.
-
created_at datetime Record creation timestamp, set automatically when a user account is provisioned
required
updated_at datetime Timestamp of the most recent preference change. Updated on every PATCH operation to support audit and cache invalidation
required

Database Indexes

idx_notification_settings_user_id
btree unique

Columns: user_id

idx_notification_settings_push_enabled
btree

Columns: push_enabled

Validation Rules

user_id_must_reference_existing_user error

Validation failed

preferences_json_schema_valid error

Validation failed

boolean_fields_not_null error

Validation failed

patch_scope_limited_to_own_settings error

Validation failed

gdpr_consent_timestamp_on_explicit_change warning

Validation failed

Business Rules

one_setting_per_user
on_create

Each user must have exactly one notification_settings record. The record is created automatically during user account provisioning with default values. No second record may be created for the same user_id.

push_master_off_revokes_tokens
on_update

When push_enabled is set to false, all FCM/APNs push tokens associated with the user must be revoked (deleted from push_tokens table) and the backend must stop routing push notifications to this user. The Push Token Store and Push Token Repository handle the revocation side-effect.

gdpr_opt_out_respected
always

The notification rule engine and email/SMS notification service must check this record before dispatching any notification. If push_enabled is false or the category-level push preference is false, the notification must be dropped for that channel. This implements the GDPR right to withdraw consent for marketing and non-critical notifications.

default_record_created_on_signup
on_create

A notification_settings record with default values (push_enabled=true, email_enabled=true, sms_enabled=false, preferences={}) must be created atomically with the users record during user provisioning. No user may exist without a corresponding notification_settings record.

category_preference_inherits_master
always

Per-category channel preferences are only evaluated if the corresponding master toggle (push_enabled, email_enabled, sms_enabled) is true. A master toggle set to false overrides all category-level preferences for that channel without modifying them.

cascade_delete_on_user_removal
on_delete

When a user is deleted (hard delete) or deactivated, the notification_settings record is removed via ON DELETE CASCADE. Soft-deactivated users retain their preferences to support reactivation.

Enforced by: Auth Backend Service

Storage Configuration

Storage Type
primary_table
Location
main_db
Partitioning
No Partitioning
Retention
Permanent Storage