Data Layer medium complexity backend
0
Dependencies
0
Dependents
1
Entities
0
Integrations

Description

Persists and retrieves notification scenario definitions and their associated trigger rule configurations. Tracks the firing history of each scenario per entity so the engine can suppress duplicate notifications. Provides query methods for loading active scenarios and auditing past trigger events.

Feature: Notification Scenarios

notification-trigger-repository

Sources & reasoning

Line 95 documents Blindeforbundet's explicit 10-day uncontacted-assignment reminder requirement - a textbook notification scenario. Line 116 frames HLF's follow-up improvement around scenario-based push messages. Both sources place this in Phase 2 (→ v1.0), matching the blueprint's [v1.0] tag.

  • docs/source/likeperson.md · line 95
    Automatisk påminnelse etter 10 dager dersom kontakt ikke er opprettet.
  • docs/source/likeperson.md · line 116
    Scenariobaserte push-meldinger og kalendersynkronisering.

Responsibilities

  • Store and retrieve notification scenario definitions with their trigger rule payloads
  • Record each scenario firing event with entity ID, timestamp, and outcome
  • Query active scenarios filtered by trigger type or target entity category
  • Provide lookups to determine whether a scenario has already fired for a given entity within a time window
  • Support soft-deletion and versioning of scenario definitions without losing history

Interfaces

saveScenario(scenario: NotificationScenario): Promise<void>
getActiveScenarios(): Promise<NotificationScenario[]>
recordFiringEvent(event: ScenarioFiringEvent): Promise<void>
hasFiredRecently(scenarioId: string, entityId: string, windowDays: number): Promise<boolean>
getFiringHistory(scenarioId: string): Promise<ScenarioFiringEvent[]>

Related Data Entities (1)

Data entities managed by this component