Service Layer high complexity backend
0
Dependencies
0
Dependents
3
Entities
0
Integrations

Description

Server-side Supabase Edge Function service that evaluates configurable scenario rules against database state changes and enqueues push notifications via FCM. Triggered by database webhooks on relevant table changes such as new assignments, inactivity thresholds, and approaching deadlines.

Feature: Push Notifications & Scenario-Based Alerts

notification-scenario-engine

Responsibilities

  • Evaluate scenario trigger conditions against database events
  • Resolve target user device tokens from push_notification_configs
  • Enqueue FCM push messages with structured payload
  • Respect per-user per-category opt-out settings
  • Persist sent notification records to notifications table

Interfaces

handleDatabaseEvent(event)
evaluateScenario(scenarioType, context)
resolveTargetDevices(userIds)
sendFcmMessage(tokens, payload)
persistNotificationRecord(notification)
checkUserOptIn(userId, category)