Skip to content

[BE-26] Implement bulk asset import — CSV/XLSX with dry-run validation and template #1085

Description

@yusuftomilola

Overview

Nobody registers hundreds of existing assets one modal at a time. Every competitor (Snipe-IT, Asset Panda, EZOfficeInventory) ships CSV import. exceljs and CSV tooling are already installed. The wizard UI is planned as [FE-15].

What to Build

Extend AssetsModule (or an ImportModule):

Method Path Description
POST /api/assets/import?dryRun=true|false Multipart CSV/XLSX upload
GET /api/assets/import/template Download a CSV template with headers + one example row
  • Parse CSV and XLSX; map columns to asset fields (name, category, department, serialNumber, status, condition, purchaseDate, purchasePrice, location…)
  • Category/department matched by name — auto-create or reject? Reject with a row error listing valid values (safer for v1)
  • Dry-run mode returns per-row validation results (row, status: ok|error, errors[]) without writing
  • Real run: insert valid rows, return a summary { created, failed, errors[] }; large files processed via the Bull queue ([BE-22]) if row count exceeds a threshold
  • Record CREATED history events ([BE-08]) with an import marker

References

  • Blocked by [BE-06], [BE-09]; queue via [BE-22]
  • Consumed by [FE-15] (wizard UI)

Acceptance Criteria

  • Template download matches accepted columns
  • Dry-run validates every row and writes nothing
  • Real import creates valid rows and reports precise per-row errors for the rest
  • Duplicate serial numbers within the file or against the DB are flagged
  • 1,000-row file imports without timing out the request

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions