Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Danielings/Pasantia-Proyecto/llms.txt

Use this file to discover all available pages before exploring further.

The Export API allows authenticated users to download filtered snapshots of the inventory as PDF or Excel files. It aggregates data from both the equipos and perifericos Firestore collections, applies the same sede-scoping rules as GET /api/componentes (Superadministradores see all records; other roles see only their own sede), and then applies any additional query-parameter filters before generating the file. PDF output is a landscape A4 document with a styled table and alternating row shading. Excel output is a single-sheet .xlsx workbook with seven fixed columns. Both formats use the same underlying filtered dataset, so the row count in the file matches what the UI displays.

GET /api/export/tipos

Returns an alphabetically sorted array of all canonical asset type strings currently present in the inventory. The list is derived dynamically from the actual documents in Firestore rather than a static enum, so new types appear automatically once at least one asset of that type is registered. Auth: Required.

Request

No parameters.

Response

Returns a JSON array of strings:
[n]
string
A canonical type label, capitalized consistently via the CANONICAL_TIPOS map (e.g., "PC", "Laptop", "Monitor", "Mouse", "Teclado", "Switch", "Impresora", "Corneta").

Example

curl http://localhost:3001/api/export/tipos \
  -H "Cookie: acceso_token=<JWT>"
["Corneta", "Impresora", "Laptop", "Monitor", "Mouse", "PC", "Switch", "Teclado"]

GET /api/export/descargar

Generate and download a filtered inventory report. The response body is a binary file stream — either a PDF or an Excel workbook — with appropriate Content-Type and Content-Disposition headers so that browsers and curl can save it directly to disk. Auth: Required.
The generated PDF title includes the applied type label and the total record count, for example: "Inventario — Monitor (12 registros)". For a full inventory report, the title reads "Inventario — Información completa (N registros)".

Request

formato
string
required
Output format. Must be "pdf" or "excel" (case-insensitive).
tipo
string
Asset type to include. Pass "completa" or "completo" (or omit entirely) to include all types. Pass a canonical type string such as "Monitor" or "PC" to restrict to one type.
estados
string
Comma-separated list of condition values to include (e.g., "Bueno,Regular"). Items not matching any of the listed states are excluded.
modelos
string
Comma-separated list of model names to include (e.g., "S24F350,K120"). Exact match against the stored modelo field.
sedes
string
Comma-separated list of office names to include (e.g., "Torre Norte,Oficina Central"). Matched against the sede field of the deployment location.
tipos
string
Comma-separated list of asset types to include. Provides multi-type filtering when you need more than one type but not all (e.g., "Monitor,Teclado,Mouse"). This filter is applied in addition to — and independently of — the tipo parameter.
Free-text search string. Matched against the normalized marca and serial fields of each record. A record is included if either field contains the search string as a substring (case-insensitive, accent-insensitive).

Response

PDF (formato=pdf):
  • Content-Type: application/pdf
  • Content-Disposition: attachment; filename="inventario-<type>-<date>.pdf"
  • Body: Binary PDF buffer. Landscape A4. Columns: Tipo, Serial, Marca, Modelo, Ubicación, Estado, Observaciones.
Excel (formato=excel):
  • Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • Content-Disposition: attachment; filename="inventario-<type>-<date>.xlsx"
  • Body: Binary .xlsx buffer. Single worksheet named "Inventario".
Excel columns (in order):
ColumnFieldWidth (chars)
TipoAsset type14
SerialSerial number18
MarcaBrand14
ModeloModel14
UbicaciónDeployment sede18
EstadoCondition12
Observacionesnotas field30

Examples

Download a full PDF inventory:
curl -o inventario-completo.pdf \
  "http://localhost:3001/api/export/descargar?formato=pdf&tipo=completa" \
  -H "Cookie: acceso_token=<JWT>"
Download an Excel file filtered to good-condition monitors and keyboards in Torre Norte:
curl -o inventario-filtrado.xlsx \
  "http://localhost:3001/api/export/descargar?formato=excel&tipos=Monitor,Teclado&estados=Bueno&sedes=Torre%20Norte" \
  -H "Cookie: acceso_token=<JWT>"
When combining tipo and tipos in the same request, both filters are applied independently. To avoid unintended empty results, use only one of them at a time — tipo for a single type, tipos for a comma-separated multi-type selection.

Build docs developers (and LLMs) love