Reports
Feature: Monthly performance reports per tenant · Status: [Live]
Reports are AI-written or DM-uploaded performance summaries that clients can read and download. They appear in both the Dashboard (client portal, :3000) and the DM Portal (:3002).
Contents
| Doc | What it covers |
|---|---|
| Screens | List page + Detail page — layout, fields, actions |
| Architecture | Data model, BullMQ worker, API endpoints, Agent Chat tool |
Report Sources
Three sources are merged and sorted by createdAt desc on both list pages:
source | How it’s created | createdBy shown |
|---|---|---|
agent | Activity planner creates a monthly_report activity; when the activity status reaches done, it appears in Reports | ”Report Agent” |
dm_upload | DM manually uploads a PDF or Markdown file via the Upload modal | uploadedByName |
ai_generated | User submits a prompt + date range; BullMQ custom-report-writer worker generates it | requestedByName |
Portals
| Portal | URL | Can generate AI report | Can upload | Can view |
|---|---|---|---|---|
| Dashboard | /reports | Yes | No | Yes |
| DM Portal | /reports | Yes | Yes | Yes |
PDF Export
Markdown reports (both agent and ai_generated) can be downloaded as a branded PDF from the detail page. The export uses marked.parse() → branded HTML cover + TOC + content + footer → window.open() → window.print(). PDF reports (dm_upload with contentType=pdf) link directly to the DigitalOcean Spaces URL.