feat: importar csv y auditar ediciones

This commit is contained in:
mono
2026-10-25 18:20:04 -05:00
parent 8e286d6fec
commit 01b5ee64cc
23 changed files with 483 additions and 19 deletions

View File

@@ -0,0 +1,33 @@
# Spec Delta
## Purpose
Permite cargar rápidamente el inventario inicial desde archivos CSV locales, creando sólo las entidades que no existen y evitando duplicados por diferencias de formato en los nombres.
## ADDED Requirements
### Requirement: Importar inventario CSV
The system SHALL import CSV rows with product name, producer name, unit price, and optional quantity columns.
#### Scenario: Importación válida
- **GIVEN** a CSV with the required headers
- **WHEN** user previews and confirms the import
- **THEN** missing producers and products are created
- **AND** a positive quantity creates an initial inventory movement
- **AND** empty or zero quantity creates no movement
### Requirement: Comparación normalizada
The system SHALL match producer and product names ignoring case, accents, BOM, and redundant surrounding whitespace.
#### Scenario: Evitar duplicado
- **GIVEN** an existing producer `La Familia González`
- **WHEN** CSV contains ` la familia gonzalez `
- **THEN** the row uses the existing producer instead of creating a duplicate
### Requirement: Errores de importación
The system SHALL report invalid rows without persisting invalid records and SHALL show a summary of created, reused, skipped, and failed rows.
#### Scenario: Precio inválido
- **WHEN** a row has a non-numeric or negative price
- **THEN** that row is rejected with its line number and reason
- **AND** valid rows remain importable