Skip to content

Feat/refactor notification infrastructure#55

Merged
Rashed99Azm merged 2 commits into
develop-backendfrom
feat/refactor-notification-infrastructure
Jun 13, 2026
Merged

Feat/refactor notification infrastructure#55
Rashed99Azm merged 2 commits into
develop-backendfrom
feat/refactor-notification-infrastructure

Conversation

@Rashed99Azm

Copy link
Copy Markdown
Collaborator

Summary
Implements the full content notification pipeline: when news, resources, or events are published, the system fans out InApp + Email notifications to content authors and newsletter subscribers. Includes a new newsletter subscription system, rich HTML email rendering with personalized recipient names and article content, and fixes a DbContext concurrency bug in the fan-out consumer.
Adds

  • ContentNotificationConsumer — handles NewsPublished/ResourcePublished/EventScheduled integration events; fans out to author and subscriber audience
  • Newsletter subscription repository + endpoints — INewsletterSubscriptionRepository, subscription management on the External API, audience queries with user names
  • Rich HTML email template — NEWS_PUBLISHED Email now renders RecipientName, ContentBodyAr/ContentBodyEn, ArticleUrl CTA button, wrapped in a shared responsive layout (SmtpEmailSender.WrapInLayout)
  • Integration events + bus publishers — NewsPublishedIntegrationEvent, EventScheduledIntegrationEvent, ResourcePublishedIntegrationEvent with corresponding domain-event handlers that publish to MassTransit
  • Notification data query — INewsRepository.GetNotificationDataAsync returns bilingual title + body for email rendering
  • Seeder improvements — templates auto-update when body/subject changes (not skip-only); fallback lookup by (Code, Channel) to prevent duplicate-key on reseed
  • Frontend:BaseUrl config key for article link construction in emails
  • DbContext concurrency fix — sequential awaits in FanOutAsync to prevent parallel-use exception

…r email support

- Add ContentNotificationConsumer handling News/Resource/Event publish events
  with per-subscriber fan-out (RecipientName, ContentBody, ArticleUrl)
- Fix DbContext concurrency bug in FanOutAsync (sequential awaits)
- Add NewsletterSubscriptionRepository + INewsletterSubscriptionRepository
  for fetching audience with user names (RecipientName)
- Add INewsRepository.GetNotificationDataAsync returning bilingual
  title + content body for email rendering
- Update SmtpEmailSender with shared responsive HTML layout wrapper
- Add NewsPublishedIntegrationEvent + bus publishers for async dispatch
- Update NotificationTemplateSeeder: NEWS_PUBLISHED Email now renders
  rich HTML with RecipientName, ContentBodyAr/En, and ArticleUrl CTA
- Add update-if-changed logic to seeder (no longer skip-only)
- Add fallback lookup by (Code, Channel) to fix duplicate-key on reseed
- Add Frontend:BaseUrl to appsettings for article link construction
- Add newsletter subscription endpoints to External API
@Rashed99Azm Rashed99Azm merged commit cfc51ee into develop-backend Jun 13, 2026
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.

2 participants