The Judicial Backend generatesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/BladimirGS/judicial-backend/llms.txt
Use this file to discover all available pages before exploring further.
.xlsx files using ExcelJS through a shared, abstract ExcelBuilder class that lives in src/shared/excel/. Module-level report classes extend this builder, declare their column layout and section definitions, then call build() to receive a ready-to-stream Buffer. Controllers pipe that buffer directly to the HTTP response with the appropriate download headers.
ExcelBuilder
Abstract base class in
src/shared/excel/excel.builder.ts. Manages the ExcelJS workbook and worksheet, exposes protected helpers for ranged rows, flat rows, subtotals, vertical merges, and the final toBuffer() call.Styles
src/shared/excel/excel.styles.ts — pre-built Partial<ExcelJS.Style> objects for header bands, data rows, subtotals, and zebra striping, all built from a shared color palette.Types
src/shared/excel/excel.types.ts — ColumnRange, ReportSection<T>, and ColumnWidth interfaces that describe the shape of every section in a report.Module reports
Concrete subclasses in
src/modules/*/reports/excel/ extend ExcelBuilder, define their ReportSection constants, and implement build().Shared Types
All column and section metadata is expressed with three interfaces fromexcel.types.ts.
ColumnRange uses a start/end pair instead of a single index. Cells between start and end are physically merged after the row is written, giving the appearance of wide columns even though ExcelJS works cell-by-cell internally.Styles
excel.styles.ts exports a Styles constant and a zebraStyle helper. The full color palette is:
| Token | ARGB | Usage |
|---|---|---|
primary | FF9BC2E6 | Primary header fill (blue) |
primaryLight | FFDDEBF7 | Even data rows |
secondary | FFD9D9D9 | Secondary header / subtotal fill (grey) |
background | FFFFFFFF | White — odd rows and vertical merge cells |
text | FF000000 | All font colors |
ExcelBuilder — Abstract Class
ExcelBuilder is declared abstract so it can never be instantiated directly. Every concrete report class must implement build(data: unknown[]): Promise<Buffer>.
Constructor
sharedWorkbook lets multiple report sheets share the same .xlsx workbook (used by the statistics multi-sheet export).
Abstract method
Protected methods available to subclasses
addSectionHeader and addSectionData delegate to the private addRangedRow method, which writes the physical ExcelJS row, applies styles cell-by-cell, sets thin borders, and then calls mergeCells for every ColumnRange with start !== end.Module-Level Reports
ApelacionExcelReport (búsqueda completa)
Located at src/modules/busqueda/reports/excel/apelacion-excel.report.ts.
ReportSection constants defined at module scope:
| Constant | Type param | Columns | Purpose |
|---|---|---|---|
SECCION_PRINCIPAL | ApelacionDTO | 1–30 (17 ranges) | Core apelación fields |
SECCION_PARTES | ParteDTO | 2–18 (5 ranges) | Associated parties |
SECCION_ANEXOS | AnexoDTO | 2–18 (9 ranges) | Attached annexes |
build() calls escribirPrimeraFila() (total + expedition date), then loops over apelaciones printing the main section followed by inline partes and anexos sub-sections for each record.
EstadisticaPlanoExcelReport (estadísticas)
Located at src/modules/estadistica/reports/excel/estadistica-plano-excel.report.ts.
zebraStyle as the rowStyle callback and accepts an optional sharedWorkbook so the statistics endpoint can bundle multiple sheets (plano, agrupado, gráfico) into a single .xlsx file.
Export Endpoints
All export routes are protected by the JWTprotect middleware. Query parameters follow the same filter shape as the corresponding search endpoints.
| Method | Path | Report class | Description |
|---|---|---|---|
GET | /api/busquedas/exportar-excel | ApelacionExcelReport | Full apelaciones with partes and anexos |
GET | /api/busquedas/plano/exportar-excel | ApelacionPlanoExcelReport | Flat apelaciones (scalars only) |
GET | /api/busquedas/historico/exportar-excel | ApelacionHistoricoExcelReport | Historical apelaciones |
POST | /api/estadisticas/exportar | EstadisticaPlanoExcelReport + others | Statistics — plano, agrupado, gráfico sheets |
HTTP Response Headers
Example — download with curl
Data Flow
The sequence from HTTP request to downloaded file is:The
Buffer returned by toBuffer() is produced by ExcelJS’s workbook.xlsx.writeBuffer(). No temporary files are written to disk — the workbook is serialized entirely in memory before being streamed to the client.