Service Layer medium complexity backend
1
Dependencies
1
Dependents
2
Entities
0
Integrations

Description

Prevents repeated notification sends by querying the notification audit log and comparing each candidate send against the rule's configured cooldown_hours. Ensures the rule engine is fully idempotent — running the same evaluation window multiple times (e.g., after a cron retry) never results in a user receiving the same notification twice within the cooldown period.

Feature: Notification Scenarios

notification-deduplication-service

Responsibilities

  • Query the notification audit log to determine whether a rule-user pair was notified within the cooldown window
  • Record each successful dispatch to the audit log for future deduplication lookups
  • Support idempotent rule engine re-runs by making sent-checks deterministic

Interfaces

hasRecentNotification(userId: string, ruleId: string, cooldownHours: number)
recordNotificationSent(userId: string, ruleId: string, notificationId: string, sentAt: Date)
getNotificationHistory(userId: string, ruleId: string, since: Date)
clearExpiredRecords(retentionDays: number)

Relationships

Dependencies (1)

Components this component depends on

Dependents (1)

Components that depend on this component

Related Data Entities (2)

Data entities managed by this component