Skip to content

feat: store sent notifications to DB - #52

Merged
busehalis-sap merged 14 commits into
mainfrom
feat/store-notifications-db
Aug 3, 2026
Merged

feat: store sent notifications to DB#52
busehalis-sap merged 14 commits into
mainfrom
feat/store-notifications-db

Conversation

@busehalis-sap

@busehalis-sap busehalis-sap commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Some applications need the notifications stored to DB to do further processing with them. This PR adds optional DB storage for sent notifications in both production and local mode.

When cds.notifications.storeNotifications: true is set, each notification is stored to the database after being sent. In production mode, the ANS-assigned notification ID is used directly. In local mode, a UUID is generated locally. Since a single notification can be sent to multiple recipients, one row per recipient is created.

Changes

  • NotificationStorage.cds: CDS model with @PersonalData annotations for Notifications, NotificationProperties and NotificationTargetParameters entities
  • StoreNotificationsHandler: @After handler on NotificationProviderService that stores notifications to DB after ANS delivery in production mode
  • StoreNotificationsLocalHandler: @After handler on ApplicationService that stores notifications to DB in local mode
  • NotificationStorageHelper: shared helper class containing the DB persistence logic used by both handlers
  • LocalHandler: sets the sent notifications on the event context so StoreNotificationsLocalHandler can access them
  • NotificationServiceConfiguration: reads storeNotifications flag and conditionally registers the appropriate handler based on the current mode
  • Integration tests: 4 new tests covering DB storage, properties, target parameters and multiple recipients, and 1 test for local mode
  • Sample app: demonstrates the feature with StoredNotifications projection and key bookId field

@busehalis-sap
busehalis-sap requested a review from lisajulia July 27, 2026 13:27

@lisajulia lisajulia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small changes, otherwise this is fine :)
Thanks!

@Schmarvinius Schmarvinius left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just minor stuff

@Schmarvinius Schmarvinius left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think its fine but please await lisas review as well

@lisajulia lisajulia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now :)

@busehalis-sap
busehalis-sap merged commit f7dc379 into main Aug 3, 2026
7 checks passed
@busehalis-sap
busehalis-sap deleted the feat/store-notifications-db branch August 3, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants