The billing module in La Oficina Nítida lets each educational operator maintain a customer catalogue, a product/service catalogue, and a complete invoice ledger — all scoped to the authenticated tenant so data never crosses organisational boundaries. The module is implemented with three resource groups (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Glemynart/SaaS/llms.txt
Use this file to discover all available pages before exploring further.
customers, products, and invoices) backed by the Customer, ProductService, and Invoice Prisma models.
Billing Dashboard
GET /billing/dashboard returns a real-time snapshot of the tenant’s billing activity. The service resolves two parallel queries — a customer count and an invoice group-by — and returns the following fields:
| Field | Type | Description |
|---|---|---|
clientesActivos | number | Count of customers with status = ACTIVE |
facturasEmitidas | number | Total number of invoices with status = ISSUED |
facturasBorrador | number | Total number of invoices with status = DRAFT |
ingresosEstimados | number | Sum of total across all ISSUED invoices |
totalFacturado | number | Gross billed amount — same source as ingresosEstimados |
invoices table — no cached counters are used.
Invoice Status Lifecycle
EveryInvoice record moves through a linear state machine driven by the InvoiceStatus enum:
| Status | Meaning |
|---|---|
DRAFT | The invoice is editable and has not yet been confirmed. |
ISSUED | The invoice has been issued to the customer. Totals are finalised. |
CANCELLED | The invoice has been voided. A cancelled invoice cannot be modified — the server returns 400 Bad Request on any further status update. |
ADMIN users may call PATCH /billing/invoices/:id/status to advance or change state.
Invoice Totals Calculation
When a new invoice is created, the server derives financial totals automatically from the submitted line items. You must not sendsubtotal, impuestos, or total in the request body — they will be ignored.
The calculation applied per invoice is:
subtotal snapshot (cantidad × valorUnitario), so the invoice remains accurate even if the underlying product catalogue changes later.
Authentication and Authorisation
All billing endpoints require a valid JWT (JwtAuthGuard) and an active tenant (ActiveTenantGuard). Role requirements per operation are:
| Operation | Minimum Role |
|---|---|
| Read any resource | VIEWER, OPERADOR, or ADMIN |
| Create / update a customer | ADMIN or OPERADOR |
| Create an invoice | ADMIN or OPERADOR |
| Create / update a product | ADMIN only |
| Delete a customer | ADMIN only |
| Update invoice status | ADMIN only |
Explore the Module
Customers
Create and manage billing customers with Colombian fiscal data: NIT and contact information.
Invoices
Create invoices with line items and manage their lifecycle from draft to issued or cancelled.