Skip to content

[BE-23] Implement CSV and Excel asset export with ExcelJS in opsce module #748

@yusuftomilola

Description

@yusuftomilola

Problem

Asset managers need to export data for reporting and offline analysis. exceljs and json2csv are installed but no export endpoints exist.

Proposed Solution

Create backend/src/opsce/exports/exports.service.ts and backend/src/opsce/exports/exports.controller.ts. Support CSV and XLSX formats with the same filter parameters as GET /api/assets.

Acceptance Criteria

  • GET /api/assets/export?format=csv returns a downloadable .csv file
  • GET /api/assets/export?format=xlsx returns a downloadable .xlsx file
  • Exported columns: ID, Name, Category, Status, Condition, Serial Number, Department, Location, Assigned To, Purchase Date, Purchase Value, Current Value
  • Accepts the same filter query params as the assets list endpoint (status, category, departmentId, etc.)
  • Response sets Content-Disposition: attachment; filename=assets-export-{date}.csv
  • Returns 400 if format is not csv or xlsx

Metadata

Metadata

Assignees

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