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

Description

Scenario Rules Service

Feature: Notification Scenarios

scenario-rules-service

Responsibilities

  • Evaluate scenario trigger conditions against current database state for each tenant
  • Apply per-organization thresholds and enabled scenario flags from notification_rules
  • Enforce strict tenant isolation - never cross-join data across organizations
  • Produce a notification event record before dispatch to enable idempotency checks
  • Look up scenario definitions from the scenario registry for data-driven evaluation

Interfaces

evaluateAllScenarios(organizationId: string): Promise<NotificationEvent[]>
evaluateScenario(scenarioId: string, organizationId: string): Promise<NotificationEvent[]>
isWithinCooldown(scenarioId: string, userId: string, entityId: string): Promise<boolean>
recordCooldown(scenarioId: string, userId: string, entityId: string): Promise<void>
getEnabledScenarios(organizationId: string): Promise<ScenarioDefinition[]>
resolveThreshold(scenarioId: string, organizationId: string): Promise<number>

Relationships

Dependencies (3)

Components this component depends on

Dependents (2)

Components that depend on this component