Scheduled Notification Overview
Core Relationships Diagram
ScheduledNotification
Stores information about a notification scheduled to be sent to a user. It includes the scheduled date/time, the type of notification, the related User, optionally an Intention, and the specific item (messageable) that the notification is about (e.g., an Affirmation, Letter). It also tracks when the notification was last sent.
User
Represents the user account that will receive the scheduled notification.
Intention
linked to a ScheduledNotification, representing the user's intention associated with the notification's content.
messageable (Polymorphic Relationship)
Represents the specific content item the notification pertains to. This uses a polymorphic relationship (messageable_id, messageable_type) and can point to one of several models:
AffirmationLetterOpenProbabilityQuestionDeconstructionQuestion
Affirmation
Represents an affirmation statement. Can be the messageable item for a scheduled notification.
Letter
Represents a letter written by the user. Can be the messageable item for a scheduled notification.
OpenProbabilityQuestion
Represents an open probability question. Can be the messageable item for a scheduled notification.
DeconstructionQuestion
Represents a deconstruction question. Can be the messageable item for a scheduled notification.