Skip to content

[BE-70] Implement data export — CSV and XLSX export for assets, audit logs, and reports #1040

Description

@yusuftomilola

Overview

Finance and compliance teams regularly need to extract data from AssetsUp into spreadsheets for external reporting, auditing, and processing. This issue adds CSV and XLSX export support for the three most-requested datasets: assets, audit logs, and report summaries.

Context

  • exceljs is a well-maintained library for XLSX generation — evaluate and install
  • Exports for large datasets must be streamed, not buffered in memory (use Node.js Readable streams or exceljs streaming API)
  • Exports should respect the same RBAC scoping as the underlying list endpoints (MANAGER sees their department only)

Acceptance Criteria

  • Install exceljs and add to package.json
  • GET /assets/export?format=csv|xlsx&status=&category=&department= — exports all matching assets applying the same filters as the list endpoint; streams the file as a download
  • GET /audit-logs/export?format=csv|xlsx&from=&to= — exports filtered audit log entries (ADMIN only)
  • GET /reports/export?format=csv|xlsx — exports the summary report data including by-category and by-department breakdowns
  • Set correct Content-Disposition: attachment; filename="assets-2024-01-01.xlsx" and Content-Type headers
  • XLSX exports include a header row with human-readable column names (not camelCase field names)
  • For CSV: fields containing commas or newlines are properly quoted

Metadata

Metadata

Assignees

No one assigned

    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