User Overview
Core Relationships Diagram
User
The central model representing an authenticated user in the application. Contains primary login credentials (email/phone), basic identification (name), and verification status. It serves as the anchor for most other user-related data.
UserProfile
Stores additional demographic and profile information related to a User, such as gender, date of birth, location (country/city), and biography. Linked one-to-one with User.
NotificationSetting
Manages user preferences for receiving different types of scheduled notifications, including the allowed time window (start_time, end_time) and desired frequency. Each user can have multiple settings for different notification types.
Order
Represents a purchase transaction initiated by the User, typically for a VipPackage. Stores payment details, status, and amounts.
VipSubscription
Represents the user's access grant to VIP features, usually resulting from a completed Order. Stores validity dates and status. A user might have multiple historical subscriptions.
ScheduledNotification
Stores individual notifications scheduled to be sent to the User at a specific date_time. Linked to the specific content (messageable) and potentially an Intention.
EmotionalMapLog
Records an entry made by the User within the Emotional Map feature, logging a specific Emotion on a given date.
Subscription
A polymorphic model linking the User to subscribable features like Challenge or EmotionalMap. It tracks the user's enrollment in these features.
ChallengeLog
Records the user's progress within a Challenge, linked indirectly to the User via the Subscription record.
UserVerification
Stores verification codes or statuses associated with the User (e.g., email or phone verification codes).
UserLetter
Tracks user-specific interactions or versions related to Letter content.
UserAffirmation
Tracks user-specific interactions or versions related to Affirmation content.
ArchiveUserAffirmations
Stores archived versions of user affirmations.
ArchiveUserLetters
Stores archived versions of user letters.
Notification
Represents general notifications sent to the User (distinct from scheduled notifications based on intentions).
AdView
Records instances where a User has viewed an advertisement within the application.
IntentionHistory
Logs changes to the User's selected Intention over time.
Device
A polymorphic model storing information about devices (identified by fcm_token, type, etc.) associated with the User.
CustomAffirmation
Represents affirmations created by the User themselves.
CallbackLog
Logs raw data received from external payment providers, linked directly to the User (also often linked via VipSubscription).
VipSubscriptionHistory
An audit trail recording significant events related to a User's VIP subscriptions.