Skip to content

feat: add GET /reports endpoint — list previously generated reports with download links #152

@BigBen-7

Description

@BigBen-7

Description

POST /generate-daily-report saves files to the reports/ directory and returns the file path, but there is no way to list or re-download previously generated reports without direct filesystem access. In a containerised environment the path is ephemeral anyway — reports must be accessible via the API.

Requirements & context

  • GET /reports (ADMIN) returns a list of generated reports:
    { "reports": [ { "filename": "daily_report_2025-01-01_...", "report_date": "2025-01-01", "format": "csv", "size_bytes": 4096, "generated_at": "ISO", "download_url": "/reports/download/daily_report_..." } ] }
  • GET /reports/download/{filename} (ADMIN) streams the file as a FileResponse
  • Store report metadata in a generated_reports Postgres table instead of relying on the filesystem
  • On startup, scan reports/ and populate the table with any existing files
  • Write tests for list and download endpoints

Suggested execution

git checkout -b feat/reports-list-download-api
  • Create generated_reports table
  • Add routes to src/main.py
  • Update generate_daily_report_csv to insert metadata row
  • Write tests

Guidelines

  • Cap listing at 100 most recent reports
  • PR must include: Closes #[issue_id]
  • Timeframe: 72 hours

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementNew feature or improvementreportsReport generation and delivery

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions