Skip to content

Add job monitoring, bulk import, channel update events, and notification export#532

Open
amanosiadnan-cmyk wants to merge 1 commit into
Core-Foundry:mainfrom
amanosiadnan-cmyk:feat/jobs-import-export
Open

Add job monitoring, bulk import, channel update events, and notification export#532
amanosiadnan-cmyk wants to merge 1 commit into
Core-Foundry:mainfrom
amanosiadnan-cmyk:feat/jobs-import-export

Conversation

@amanosiadnan-cmyk

Copy link
Copy Markdown
Contributor

closes #492
closes #489
closes #481
closes #502

PR description

Summary

  • Background job monitoringJobMonitor records scheduled job status; failures are logged; APIs + docs for maintenance.
  • Bulk notification import — Admins can import JSON/CSV batches; invalid rows are skipped; import summary is returned.
  • Channel update events — Contract emits ChannelPreferenceUpdated on channel preference changes, with tests.
  • Notification export — Search page Export button downloads filtered results as JSON/CSV; format documented.

Task 1 — Add Background Job Monitoring

  • New listener/src/services/job-monitor.ts tracks running / completed / failed jobs.
  • Wired into NotificationScheduler so each scheduled notification is monitored.
  • Failed jobs logged via logger.error and retained in a failure list.
  • Endpoints: GET /api/schedule/jobs, GET /api/schedule/jobs/failures
  • Docs: docs/JOB_MONITORING.md (+ link from docs/MONITORING_INTEGRATION.md)
  • Tests: job-monitor.test.ts

Task 2 — Support Bulk Notification Import

  • New NotificationImportService accepts JSON arrays / { notifications: [] } or CSV.
  • Invalid records skipped safely; valid rows scheduled through NotificationAPI.
  • Endpoint: POST /api/notifications/import (honors X-API-Key when configured)
  • Response summary: total, imported, skipped, importedIds, skippedRecords, format, durationMs
  • Docs: docs/BULK_NOTIFICATION_IMPORT.md
  • Tests: notification-import-service.test.ts

Task 3 — Emit Event for Channel Updates

  • New ChannelPreferenceUpdated event in base/events.rs with recipient, channel, enabled, updated_at (+ category/priority topics).
  • Emitted from set_channel_preference, set_preferences, and reset_preferences.
  • Tests in preferences_test.rs assert emission and per-channel counts.

Task 4 — Add Notification Export Button

  • Export controls on NotificationSearchPage (JSON/CSV).
  • Uses current filters; paginates through all matching results before download.
  • Helpers + format docs: dashboard/src/utils/notificationExport.ts, docs/NOTIFICATION_EXPORT_FORMAT.md
  • Tests: notificationExport.test.ts

Test plan

  • GET /api/schedule/jobs returns snapshot after scheduler activity
  • Force a failed delivery → appears in /api/schedule/jobs/failures and logs
  • POST /api/notifications/import with mixed valid/invalid JSON → summary shows skip + import
  • Import CSV with missing recipient → row skipped, others imported
  • set_channel_preference emits channel_preference_updated
  • Notification Search: apply filters → Export JSON/CSV → file matches filters
  • Confirm export format matches docs/NOTIFICATION_EXPORT_FORMAT.md

@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@amanosiadnan-cmyk Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Add Notification Export Button Support Bulk Notification Import Add Background Job Monitoring Emit Event for Channel Updates

1 participant