MindFlow’s Notification Service keeps students aware of upcoming deadlines without overwhelming them. It runs as a scheduled cron job every hour, scans for tasks whose deadlines fall within the next 24 hours, and dispatches a reminder if the task still has pending micro-objectives. To prevent notification fatigue, the service enforces a hard cap of 3 dispatched notifications per student per 24-hour window. When a student is in the middle of an active EMA session, all deadline reminders are suppressed for the duration of that session — avoiding interruption at the most cognitively sensitive moment. Every notification event, whether sent, failed, or suppressed, is recorded in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/J0S3-LEON/pf_pruebasAseguramientoCalid_SDD/llms.txt
Use this file to discover all available pages before exploring further.
notification_logs table with a UTC timestamp and a delivery status.
Trigger condition
A deadline reminder is eligible to be dispatched when all of the following conditions are true:- The task has
is_deleted = false. - The task’s
deadlinefalls within the next 24 hours from the current time. - The task has at least one micro-objective where
is_completed = falseandis_audit_only = false.
Notification frequency cap
The Notification Service enforces a maximum of 3 sent notifications per student per 24-hour rolling window. Once a student has 3sent records within that window, no further dispatches occur for the remainder of that period — even if additional eligible tasks exist. This limit is checked via the getDispatchCount method before any dispatch attempt is made.
Session suppression
If the student has an active session (is_active = true) at the time the cron job runs, all deadline reminders for that student are suppressed. A suppressed record is still written to notification_logs so the event is fully auditable. Suppression ends as soon as the session becomes inactive (i.e. after the fatigue score is submitted and the session is closed).
Retry logic
The Notification Service attempts to deliver the notification. On success, the log record is written (or updated) with
status = "sent" and attemptCount = 1.If delivery fails,
attemptCount is incremented and the record status stays "pending". On the next cron run, the service detects the existing pending record and attempts delivery again.Audit logging
Every notification event — dispatched, failed, or suppressed — produces exactly one record innotification_logs. No event is silently dropped.
Notification log fields
| Field | Type | Description |
|---|---|---|
id | UUID | Unique identifier of the log record |
studentId | UUID | The student this notification targets |
taskId | UUID | The task whose deadline triggered the reminder |
status | pending | sent | failed | suppressed | Current delivery status |
attemptCount | integer | Number of delivery attempts made so far |
dispatchedAtUtc | UTC timestamp | When this log record was created or last updated |
The INotificationService interface
dispatchReminders()— the main entry point, decorated with@Cron(CronExpression.EVERY_HOUR). Finds all eligible tasks and processes each student-task pair.suppressDuringSession(studentId)— queries thesessionstable for an active session (is_active = true). Returns aPromise<boolean>that resolves totrueif one exists, meaning notifications should be suppressed.getDispatchCount(studentId, windowHours)— countssentrecords in thenotification_logstable within the given rolling window. Used to enforce the 3-per-day cap.
Processing flow per task
The following diagram shows the decision path the Notification Service follows for each eligible student-task pair on every cron run:Call
suppressDuringSession(studentId). If true, write a suppressed log record and skip to the next task.Call
getDispatchCount(studentId, 24). If the count is ≥ 3, skip without writing a log record (the cap is silent).Search for an existing
pending or failed record for this student-task pair within the last 24 hours with attemptCount < 3. If none exists, create a new record with status = "pending".Call the internal
deliver(studentId, taskId) method. In production this connects to a push/email/WebSocket provider.The Notification Service runs as a scheduled cron job every hour — it does not push to clients in real time. Notifications are processed in batch on the server. Notification logs are an internal audit trail and are not exposed through a public API endpoint.