Skip to content

Add CSV export endpoint to Reports API#8

Open
shubhusion wants to merge 1 commit into
IITMBSMLOps:mainfrom
shubhusion:sdd_submission
Open

Add CSV export endpoint to Reports API#8
shubhusion wants to merge 1 commit into
IITMBSMLOps:mainfrom
shubhusion:sdd_submission

Conversation

@shubhusion
Copy link
Copy Markdown

Summary

  • Adds GET /reports/export endpoint returning RFC 4180-compliant CSV
  • Accepts the same status, date_from, date_to, sort, descending filter params as GET /reports — no pagination cap
  • Routes through ReportPublic to ensure internal_id and owner_email are never exposed in the output

Test plan

  • test_export_returns_csv_content_type — Content-Type header is text/csv
  • test_export_has_content_disposition — attachment filename is reports.csv
  • test_export_header_row — columns are id,title,status,owner,amount,created_at
  • test_export_no_internal_fieldsinternal_id and owner_email absent from all rows
  • test_export_filter_by_status?status=approved returns only approved rows
  • test_export_rfc4180_edge_case — title with commas, quotes, and embedded newline parses back as a single field
  • test_export_invalid_sort_returns_400 — bad sort field returns 400
  • test_export_all_rows_no_pagination — unfiltered export returns all 120 seed rows (8/8 passing)

🤖 Generated with Claude Code

Implements GET /reports/export returning RFC 4180-compliant CSV with the
same filter/sort params as GET /reports but without pagination. Uses
ReportPublic to ensure internal_id and owner_email are never exposed.
Includes 8 tests covering content-type, field safety, filtering, RFC 4180
edge cases, and full 120-row unfiltered export.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant