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

Description

Persists and retrieves notification scenario configurations on a per-organization basis, providing the data layer for scenario lifecycle management. It stores trigger conditions, target role definitions, delivery channel mappings, and active/inactive status for each scenario. All read and write operations are scoped to the organization to enforce data isolation.

Feature: Notification Scenarios

notification-scenario-repository

Sources & reasoning

Line 116 explicitly calls for "scenariobaserte push-meldinger" to address HLF's follow-up gap. Blueprint marks notification-scenarios [v1.0]. Second phase ordinal = v1.0. The scenario engine is the mechanism that makes scenario-based delivery possible.

  • Oppfølging av likepersoner: 40 % var ikke fornøyd med oppfølgingen i spørreundersøkelse. Scenariobaserte push-meldinger og kalendersynkronisering.

Responsibilities

  • Store and retrieve notification scenario configurations scoped by organization ID
  • Support create, update, deactivate, and delete operations for scenario records
  • Provide efficient lookup of active scenarios filtered by event type and organization
  • Maintain audit fields (created_at, updated_at, last_triggered_at) for each scenario record
  • Enforce unique scenario naming constraints within an organization

Interfaces

findByOrgId(orgId: string): Promise<NotificationScenario[]>
findActiveByEventType(orgId: string, eventType: string): Promise<NotificationScenario[]>
save(scenario: NotificationScenario): Promise<NotificationScenario>
updateStatus(scenarioId: string, active: boolean): Promise<void>
delete(scenarioId: string): Promise<void>