Skip to content

Data Model: User

Purpose: The User entity represents an individual's primary login account and authentication credentials for the platform. It is the master record that handles security, permissions, and session management. Each User account can own one or more Profile entities, which are used for the actual investment activities.

Fields/Attributes

NameTypeDescriptionValidation Rules
Core Identification
idUnique IdentifierThe primary internal system ID for the user account (e.g., UUID).• Required • System-generated, Read-only
emailEmailThe user's unique email address, used as their primary username for login.• Required, Unique • Must be a valid email format
passwordHashed TextThe user's hashed and salted password for authentication. The plain text password is never stored.• Required • Must meet complexity requirements (e.g., min 8 characters, numbers, etc.)
Personal Information
first_nameTextThe first name of the user.• Required
last_nameTextThe last name of the user.• Required
avatar_urlURLA link to the user's profile picture or avatar image.• Optional
Status & Flags
is_activeBooleanDesignates whether this user account is active and can log in.• Required • Defaults to True
is_email_verifiedBooleanFlag indicating if the user has verified their email address by clicking a confirmation link.• Required • Defaults to False
is_staffBooleanDesignates whether the user can access the admin site. (For internal users only).• Required • Defaults to False
Security & Metadata
last_login_atTimestampThe exact date and time of the user's last successful login.• Read-only • System-managed
last_login_ipIP AddressThe IP address from which the user last logged in.• Read-only • System-managed
last_login_user_agentTextThe browser/device information from the user's last login.• Read-only • System-managed
created_atTimestampThe date and time the user account was created.• Read-only
updated_atTimestampThe date and time the user account was last modified.• Read-only

Key Relationships

  • Profiles: A User account acts as a container for one or more Profile entities (a one-to-many relationship). An investor might have an Individual profile and a Trust profile, all under one User login.

  • Groups: A User can belong to multiple Groups to manage their roles and permissions (a many-to-many relationship).

Global Business Rules

  • A User account must be created with a unique, valid email address.

  • The user's email must be verified (is_email_verified = True) before they are allowed to create any investment Profiles or initiate investments.

  • Upon the user's first successful email verification, the system should automatically create a default INDIVIDUAL Profile linked to their User account to streamline onboarding.

  • All login attempts must be recorded in the LoginAttemptLog for security and auditing purposes.

  • Administrators must have the ability to forcefully terminate any user's ActiveSession, logging them out of the platform.

Auditing & Event History

Every significant action or change made to an User is recorded as an immutable entry in a system-wide EventLog. This creates a complete and tamper-proof audit trail for compliance and operational tracking.