Skip to content

Backend: Add campaign metrics CSV/JSON export endpoint #463

Description

@joelpeace48-cell

Summary

Campaign operators need to export their data for reporting, accounting, and off-platform analysis. A downloadable export of campaign stats, participants, and reward distributions covers the most common operator use cases.

Acceptance Criteria

  • Add GET /api/v1/campaigns/:id/export?format=csv|json (API key required)
  • CSV export includes columns: participantAddress, registeredAt, pointsCredited, pointsClaimed, netPoints, referredBy
  • JSON export is the same data in { campaign: {...}, participants: [...] } structure
  • Streaming response for large exports (don't buffer entire dataset in memory) — use Node.js stream pipeline
  • Set appropriate headers: Content-Disposition: attachment; filename=campaign-{id}-export.csv
  • Add date range filter: ?from=ISO_DATE&to=ISO_DATE
  • Rate limit: max 5 exports per campaign per hour
  • Audit log entry on each export
  • Unit tests for CSV format, JSON format, streaming, rate limit

References

  • backend/src/index.js
  • backend/src/dal/

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

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