32 lines
1.2 KiB
Markdown
32 lines
1.2 KiB
Markdown
# F-150 — Architect
|
|
|
|
## Feature
|
|
Reporting: CSV export.
|
|
|
|
## Objetivo
|
|
Exportar datasets filtrados a CSV con permisos, metadatos y paginación/servidor streaming.
|
|
|
|
## Diseño
|
|
|
|
### Ruta backend
|
|
`GET /reporting/export/:report?from=&to=&...`
|
|
- `:report` ∈ {summary, sales, products}
|
|
- Requiere `REPORTING_EXPORT` (admin y editor).
|
|
- Filtros iguales que los endpoints de reporting existentes.
|
|
- Content-Type: `text/csv; charset=utf-8`.
|
|
- Content-Disposition: `attachment; filename="<report>-<from>-<to>.csv"`.
|
|
- Streaming: Fetch por páginas (500 rows por página) y escribir cada página al stream raw.
|
|
- CSV headers: filas de metadatos (primera línea `# report:..., from:..., to:..., exported_at:...`).
|
|
|
|
### Admin
|
|
- Componente `<ExportButton report="sales" filters={...} />`.
|
|
- Botón que abre el CSV en nueva pestaña.
|
|
|
|
## Acceptance Criteria
|
|
AC1: GET /reporting/export/{summary|sales|products} devuelve CSV válido.
|
|
AC2: Permiso REPORTING_EXPORT requerido (admin y editor).
|
|
AC3: Streaming: respuesta grande no carga todo en memoria.
|
|
AC4: CSV con headers de metadatos (# report, from, to, exported_at).
|
|
AC5: Admin ExportButton en las páginas de reporting.
|
|
AC6: tsc 0, verify.sh verde.
|