Monitor API is backed by a PostgreSQL database managed with Prisma ORM. The schema models the complete lifecycle of an auto-body insurance claim — from initial intake through damage assessment, evidence collection, inspection checklists, and final status transitions. All models are defined inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/sheeplettuce/Monitor/llms.txt
Use this file to discover all available pages before exploring further.
prisma/schema.prisma.
Entity Overview
expediente
The central claim record. Every other entity in the schema links back to an expediente via its primary key,
no_siniestro (the accident/claim number).levantamiento_danios
A damage survey record linked to an expediente. Captures vehicle condition flags and a list of cost line items (
levantamiento_concepto).evidencia
Metadata for an uploaded file (photo, document, etc.) associated with an expediente. Tracks storage location, file type, and the user who uploaded it.
checklist
An inspection checklist linked to an expediente. Records inspector, assigned staff, condition flags, deductible, and delivery details. Contains many
checklist_item records.historial_estado
Immutable audit log of every status transition on an expediente. Each row captures the previous state, the new state, the timestamp, and the user who triggered the change.
aseguradora
An insurance company record. Expedientes reference an aseguradora to associate the claim with the issuing insurer.
usuario
A system user with an assigned role (
Administrador, Operador, or Tecnico). Linked to expedientes they created, evidence they uploaded, and state changes they triggered.Models
expediente
The root entity of the schema. Its primary key,no_siniestro, is a human-readable claim identifier rather than an auto-incremented integer, reflecting the domain convention.
Primary key. The claim or accident number used across the entire system to link every related record.
Current lifecycle stage of the claim. Defaults to
Ingreso. Valid values: Ingreso, Restauracion, Pendiente_de_salida, Salida. Every state change is automatically recorded in historial_estado.Indicates where files for this claim are stored. Defaults to
Local. Valid values: Local, Nube.Foreign key to the
aseguradora table. Nullable — a claim may be entered before the insurer is identified.Foreign key to the
usuario table. Records which user created this expediente.levantamiento_danios
A damage survey record created when a technician inspects the vehicle. One expediente can have multiple levantamiento records.Auto-incremented primary key.
Foreign key to the parent
expediente.Date the survey was performed.
Array of cost line items attached to this survey. See below.
levantamiento_concepto
Individual cost line items within a damage survey.Auto-incremented primary key.
Foreign key to the parent
levantamiento_danios.Item or part code used for cataloguing.
Human-readable description of the repair item or service.
Unit cost for this line item.
evidencia
Metadata record for every file uploaded to a claim. The actual file is stored at theruta path on the server (or in cloud storage), while this record tracks its origin and ownership.
Auto-incremented primary key.
Foreign key to the parent
expediente.Type of the uploaded file (e.g.
"image/jpeg", "application/pdf").Original filename as provided at upload time.
Path or identifier used to retrieve the file from local or cloud storage.
Timestamp of upload. Defaults to
now().Where the file is stored —
Local (default) or Nube.Foreign key to the
usuario who uploaded the file.checklist
An inspection checklist attached to an expediente. Captures the full pre-delivery / post-repair inspection record including assigned staff, condition assessments, and delivery sign-off.Auto-incremented primary key.
Foreign key to the parent
expediente.Date of the inspection.
Name of the person who performed the inspection.
Whether the checklist inspection was passed.
Deductible amount recorded at inspection.
Individual line items in the checklist. See below.
checklist_item
A single line item within achecklist. Each item records the system category it belongs to, its name, and the observed value or condition.
Auto-incremented primary key.
Foreign key to the parent
checklist.System or category the item belongs to (e.g.
"Motor", "Carrocería").Name of the specific item being inspected.
Observed value or condition recorded for this item.
historial_estado
An immutable audit log that records every status transition on an expediente. A new row is appended each time theestado field of an expediente changes, providing a complete, timestamped history of the claim’s lifecycle.
Auto-incremented primary key.
Foreign key to the
expediente whose status changed.The
estado value before the transition. Nullable to accommodate the initial state assignment on creation.The
estado value after the transition.Exact timestamp of the state change. Defaults to
now().Foreign key to the
usuario who triggered the state change. Nullable for system-initiated transitions.aseguradora
Insurance company records referenced by expedientes.Auto-incremented primary key.
Name of the insurance company.
Optional binary logo image stored directly in the database.
usuario
System users who authenticate with the API.Auto-incremented primary key.
Display name of the user.
Unique login username. Cannot contain whitespace. Used as the login credential and embedded in the JWT.
bcrypt hash of the user’s password. Never returned in API responses.
The user’s role —
Administrador, Operador, or Tecnico. Drives all authorization decisions.Enums
Tracks the lifecycle stage of an
expediente.| Value | Meaning |
|---|---|
Ingreso | Vehicle received, claim opened |
Restauracion | Actively under repair |
Pendiente_de_salida | Repair complete, awaiting collection |
Salida | Vehicle delivered, claim closed |
Defines which actions a
usuario is permitted to perform.| Value | Description |
|---|---|
Administrador | Full system access |
Operador | Create and update expedientes and levantamientos; no destructive actions |
Tecnico | Read expedientes; create and update levantamientos; no destructive actions |
Indicates where files or data are physically stored.
| Value | Description |
|---|---|
Local | Stored on the API server’s filesystem |
Nube | Stored in cloud/remote storage |
Relationships
The following diagram summarises the entity relationships in plain text:- An expediente belongs to one
aseguradora(nullable) and oneusuario(the creator, nullable). - An expediente has many
evidencia,checklist,levantamiento_danios, andhistorial_estadorecords. - A levantamiento_danios has many
levantamiento_conceptoline items. - A checklist has many
checklist_itemrecords. - A usuario is referenced by
evidencia(uploader),expediente(creator), andhistorial_estado(who changed the state). - historial_estado appends a new row on every
estadotransition. Each row capturesestado_anterior,estado_nuevo,fecha_cambio(defaults tonow()), andcambiado_por(the user ID).