Skip to content

feat(reports): implement recurring monitoring summaries with cron scheduling & email delivery#197

Open
Opulencechuks wants to merge 2 commits into
MD-Creative-Production:mainfrom
Opulencechuks:main
Open

feat(reports): implement recurring monitoring summaries with cron scheduling & email delivery#197
Opulencechuks wants to merge 2 commits into
MD-Creative-Production:mainfrom
Opulencechuks:main

Conversation

@Opulencechuks

Copy link
Copy Markdown

This PR closes #128
Description

Implemented recurring monitoring summary reports with cron scheduling and email delivery. This adds daily and weekly security posture reports that are automatically generated and sent via SMTP, providing teams with regular visibility into security status.

Type of Change

  • Bug fix (non‑breaking change which fixes an issue)
  • New feature (non‑breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Changes Made

  • Added src/modules/reports/reports.module.ts – registers report‑related providers and exports.
  • Created src/modules/reports/report.service.ts – generates daily and weekly report contents.
  • Implemented src/modules/reports/scheduler.service.ts – schedules report generation using node‑cron (daily at 08:00 UTC, weekly on Monday at 09:00 UTC).
  • Added src/modules/reports/email.service.ts – sends reports via nodemailer using environment variables SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, and REPORT_RECIPIENT.
  • Defined src/modules/reports/dto/report.dto.ts – TypeScript interface for report data.
  • Added src/modules/reports/report.service.spec.ts – unit tests for report generation and email delivery (4 passing tests).
  • Updated package.json – added node-cron and nodemailer (and their typings) as dependencies.
  • Imported ReportsModule into the root apps/backend/src/app.module.ts.

Testing

  • I have tested these changes locally.
  • Tests pass locally (bun test). All 4 report‑service tests pass.
  • Linting passes (npm run lint).
  • Code is formatted (npm run format).
  • TypeScript builds successfully (npm run build).

Checklist

  • My code follows the style guidelines of this project.
  • I have performed a self‑review of my own code.
  • I have commented my code, particularly in hard‑to‑understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings or errors.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests passed with my changes.

Screenshots (if applicable)

(No UI changes – background services only.)

Additional Context

The new reporting module is designed to be extensible; future work can replace placeholder report content with real security metrics and enhance email formatting (HTML templates, attachments). Environment variables required for email delivery should be added to the project's .env configuration.

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.

Create Scheduled Security Reports

1 participant