Every employee in La Oficina Nítida has a digital file — an expediente — that aggregates all documents related to their employment lifecycle. Documents are organized into well-defined categories, stored in Cloudflare R2, and tracked in theDocumentation 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.
ExpedienteDoc model. The expediente is the single source of truth for an employee’s document history, and it integrates directly with contract generation and the alerts engine. ExpedienteDoc is the only active model for digital files; the legacy EmployeeFile model was retired in PR6B and must not be referenced.
Document Categories
Each document in the expediente is assigned to exactly oneExpedienteCategoria:
| Category | What belongs here |
|---|---|
CONTRATO | Signed employment contracts and contract renewals generated by the platform |
AFILIACION | Social security affiliation forms: EPS, ARL, pension fund, caja de compensación |
CERTIFICADO | Employment certificates, income certificates, and other formal certifications |
DOCUMENTO_PERSONAL | Personal identity documents: cédula scans, birth certificates, academic titles |
PREAVISO | Pre-notice letters (preaviso de terminación) |
TERMINACION | Employment termination documents, settlement agreements (actas de liquidación) |
OTRO | Any document that does not fit the categories above |
byCategory statistics returned by the expediente endpoint.
Storage Key Convention
All files in the expediente follow a deterministic path pattern in Cloudflare R2:Manually uploaded documents
{id}is theExpedienteDocUUID.{version}starts at1and increments each time a new version of the same document is uploaded.{ext}is the file extension derived from the MIME type (pdf,jpg,png, etc.).
Auto-generated documents
When the platform generates a PDF contract or certificate, it creates theExpedienteDoc record with a predictable key:
gen_prefix identifies this as a platform-generated file.{generatedDocId}is the UUID of theGeneratedDocumentrecord.- Version is always
v1for generated files; retries overwrite the same path.
Accessing an Employee’s Expediente
Get the full expediente
ExpedienteDoc records for the employee, ordered by createdAt descending, along with an aggregate statistics object:
404 if the employee does not exist within the authenticated tenant.
Get a single document
GeneratedDocument summary (if applicable).
Deleting Documents
ADMIN role. Permanently removes the ExpedienteDoc row from the database. Note: this does not automatically delete the underlying file from Cloudflare R2 — storage cleanup is handled separately.
Auto-Population from Document Generation
When the platform generates a PDF (viaPOST /contracts/:id/generate-document or POST /generated-documents/:id/generate-pdf), it automatically creates a corresponding ExpedienteDoc record in the same database transaction. The category is derived from the template type:
Template tipo | Expediente categoria |
|---|---|
CONTRACT | CONTRATO |
CERTIFICATION | CERTIFICADO |
LETTER | OTRO |
MEMO | OTRO |
storageKey is set to the gen_{generatedDocId}_v1.pdf pattern, and tamanoBytes is set to 0 until real Cloudflare R2 storage integration is active in production.
This auto-population means that generating a contract PDF is a single operation that simultaneously produces the PDF, creates the GeneratedDocument record, and adds the file to the employee’s digital file — all within one atomic database transaction, with no risk of a half-committed state.
The Alerts module uses expediente documents as a deduplication anchor for
contract expiration alerts. When
POST /alerts/generate-contract-alerts runs,
it looks up the most recent ExpedienteDoc of category CONTRATO for each
expiring contract and links the alert to that document via expedienteDocId.
Employees with fully populated expedientes therefore produce more precise,
deduplicated alerts. See the Alerts module for the full
deduplication logic.