UserPreference

Stores personalized settings and preferences for each user's experience in the application. This entity allows users to customize how the application looks, behaves, and communicates with them. Preferences can range from UI themes and layout choices to notification settings, privacy options, and feature toggles. Each preference is stored as a key-value pair, making the system extensible - new preferences can be added without changing the database schema. The entity supports different data types (boolean, string, number, JSON) and can organize preferences into categories like 'appearance', 'notifications', or 'privacy'. Default values ensure new users get a sensible starting configuration, while user-specific values override these defaults. This personalization improves user satisfaction by letting each person tailor the application to their needs and working style.

13 properties
Schema

Properties

PropertyTypeModeDescriptionRequired
userUser
stored

The user who owns these preferences

Required
keystring
stored

Unique identifier for the preference setting

Example: "theme.colorScheme"

Required
valuestring
stored

The preference value stored as a string (can be parsed based on type)

Example: "dark"

Required
typestring
enum

Data type of the preference value for proper parsing

Values: string, number, boolean, json, date

Example: "string"

Optional
categorystring
stored

Grouping category for organizing related preferences

Example: "appearance"

Optional
labelstring
stored

Human-readable name for the preference

Example: "Color Scheme"

Optional
descriptionstring
stored

Help text explaining what this preference does

Example: "Choose between light and dark theme"

Optional
defaultValuestring
stored

System default if user hasn't set a value

Example: "light"

Optional
possibleValuesstring[]
stored

List of allowed values for validation

Example: ["light","dark","auto"]

Optional
isPublicboolean
stored

Whether other users can see this preference (for social features)

Optional
isEditableboolean
stored

Whether the user can change this preference

Optional
lastModifiedAtDateTime
stored

When the user last changed this preference

Optional
metadataobject
stored

Additional configuration or validation rules

Optional

Examples

Example 1

{
  "@type": "UserPreference",
  "key": "notifications.email.marketing",
  "value": "false",
  "type": "boolean",
  "category": "notifications",
  "label": "Marketing Emails",
  "description": "Receive promotional emails and newsletters about new features and updates",
  "defaultValue": "true",
  "possibleValues": [
    "true",
    "false"
  ],
  "isPublic": false,
  "isEditable": true,
  "lastModifiedAt": "2024-03-10T14:00:00Z",
  "metadata": {
    "frequency": "weekly",
    "lastOptOut": "2024-03-10T14:00:00Z"
  }
}

Example 2

{
  "@type": "UserPreference",
  "key": "dashboard.widgets.layout",
  "value": "{\"columns\":3,\"widgets\":[{\"id\":\"stats\",\"position\":1},{\"id\":\"chart\",\"position\":2},{\"id\":\"tasks\",\"position\":3}]}",
  "type": "json",
  "category": "dashboard",
  "label": "Dashboard Layout",
  "description": "Customized arrangement of widgets on your dashboard",
  "defaultValue": "{\"columns\":2,\"widgets\":[]}",
  "isPublic": false,
  "isEditable": true,
  "lastModifiedAt": "2024-02-28T09:30:00Z",
  "metadata": {
    "maxWidgets": 10,
    "allowedWidgets": [
      "stats",
      "chart",
      "tasks",
      "calendar",
      "news"
    ]
  }
}