Appearance
Entity: notificationPreference
Entity Type: Database table
Description: Per-user notification opt-in/opt-out settings, one row per user, kept on their own table rather than as columns on user. Storage only: the business meaning of each preference (when an email/SMS actually fires, what triggers an "incident") and any UI/API to manage them belongs to a future Notifications feature, not to Users & Access.
One-to-one with user: a user has at most one notificationPreference row. Whether the row is created eagerly (on user creation, with defaults) or lazily (on first preference change) is a Notifications-feature decision, not fixed by this page.
Data Attributes Table
| Attribute Name | Description | Data Type | Default Value | Required (= Nullable) | Unique | Format | Validations | Index | Example |
|---|---|---|---|---|---|---|---|---|---|
| id | Primary key of the entity. | UUID | Generated in code (app layer) | Yes | Yes | UUID v7 | - | Primary Key | 018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2 |
| userId | The user these preferences belong to. | UUID | - | Yes | Yes | UUID v7 | FK → user; must exist; one row per user. | name: uidx_notificationPreference_userId, type: btree | 018fa51f-fda1-79f4-8461-2cb8f1cabc10 |
| emailReporting | (Out of scope — Notifications feature, not yet analysed.) Per-user opt-in for email reporting. Storage only; no API/UI exposure yet. | Boolean | - | No | No | - | - | - | true |
| emailReminder | (Out of scope — Notifications feature, not yet analysed.) Per-user opt-in for email reminders. Storage only; no API/UI exposure yet. | Boolean | - | No | No | - | - | - | true |
| incidentEmailReporting | (Out of scope — Notifications feature, not yet analysed.) Per-user opt-in for incident email reporting. Storage only; no API/UI exposure yet. | Boolean | - | No | No | - | - | - | false |
| smsNotificationsEnabled | (Out of scope — Notifications feature, not yet analysed.) Per-user opt-in for SMS notifications. Storage only; no API/UI exposure yet. | Boolean | - | No | No | - | - | - | false |
| createdAt | Timestamp of when the record was created. Immutable after insert. | Timestamp with time zone | now() — set in code | Yes | No | ISO 8601 | Cannot be null; cannot be modified after creation. | - | 2025-03-16T18:00:00Z |
| updatedAt | Timestamp of the last update. | Timestamp with time zone | now() — set in code | Yes | No | ISO 8601 | Cannot be null. | - | 2025-03-16T18:00:00Z |
| deletedAt | Timestamp of soft deletion. Null means the record is active. Once set, immutable. | Timestamp with time zone | - | No | No | ISO 8601 | Immutable once set. Active records: WHERE deletedAt IS NULL | - | null |
| createdBy | Identifier of the actor who created the record. | String | - | Yes | No | type:actor | Non-empty. | - | user:018e... |
| updatedBy | Identifier of the actor who last updated the record. | String | - | Yes | No | type:actor | Non-empty. | - | user:018e... |
Audited fields
Not yet declared — storage-only, out of scope for Users & Access. The Notifications feature will declare its own "Audited fields" section here (or supersede this note) when it takes this entity on.