Skip to content

[BE-54] Implement scheduled report delivery — subscribe to automatic email reports on a cron schedule #927

Description

@yusuftomilola

Overview

Managers should receive automated report digests (weekly asset summary, monthly depreciation report) without needing to log in to the platform. Users subscribe to a report schedule and receive it by email on the configured frequency.

Context

  • Depends on BE-40 (ScheduleModule), BE-07 (MailService), BE-51–53 (report data and export)
  • Report schedules are per-user — each user configures their own subscriptions

Acceptance Criteria

  • Create ReportSchedule entity: id, userId, reportType (enum: SUMMARY, WARRANTY_EXPIRING, MAINTENANCE_COSTS, DEPRECIATION), frequency (DAILY|WEEKLY|MONTHLY), format (PDF|EXCEL), isActive, lastSentAt, nextSendAt (computed from frequency), createdAt
  • POST /reports/schedules — creates a subscription and sets nextSendAt
  • GET /reports/schedules — current user's active schedules
  • PATCH /reports/schedules/:id — toggle active, change frequency or format
  • DELETE /reports/schedules/:id
  • Add daily cron in TasksService: find schedules where nextSendAt <= now and isActive = true; generate the report via ExportService, email as attachment, update lastSentAt and nextSendAt

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions