Skip to main content

Documentation 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.

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 in 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.
no_siniestro
String
required
Primary key. The claim or accident number used across the entire system to link every related record.
estado
estado_enum
required
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.
ubicacion_almacenamiento
ubicacion_enum
required
Indicates where files for this claim are stored. Defaults to Local. Valid values: Local, Nube.
id_aseguradora
Int?
Foreign key to the aseguradora table. Nullable — a claim may be entered before the insurer is identified.
creado_por
Int?
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.
id
Int
required
Auto-incremented primary key.
no_siniestro
String?
Foreign key to the parent expediente.
fecha
Date?
Date the survey was performed.
levantamiento_concepto
levantamiento_concepto[]
Array of cost line items attached to this survey. See below.

levantamiento_concepto

Individual cost line items within a damage survey.
id
Int
required
Auto-incremented primary key.
id_levantamiento
Int
required
Foreign key to the parent levantamiento_danios.
claves
String?
Item or part code used for cataloguing.
concepto
String?
Human-readable description of the repair item or service.
costo
Decimal?
Unit cost for this line item.

evidencia

Metadata record for every file uploaded to a claim. The actual file is stored at the ruta path on the server (or in cloud storage), while this record tracks its origin and ownership.
id
Int
required
Auto-incremented primary key.
no_siniestro
String
required
Foreign key to the parent expediente.
tipo
String?
Type of the uploaded file (e.g. "image/jpeg", "application/pdf").
nombre_archivo
String?
Original filename as provided at upload time.
ruta
String?
Path or identifier used to retrieve the file from local or cloud storage.
fecha_carga
Timestamp?
Timestamp of upload. Defaults to now().
ubicacion_almacenamiento
ubicacion_enum
required
Where the file is stored — Local (default) or Nube.
subido_por
Int?
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.
id
Int
required
Auto-incremented primary key.
no_siniestro
String?
Foreign key to the parent expediente.
fecha_inspeccion
Date?
Date of the inspection.
inspeccionado_por
String?
Name of the person who performed the inspection.
aprobada
Boolean?
Whether the checklist inspection was passed.
deducible
Decimal?
Deductible amount recorded at inspection.
checklist_item
checklist_item[]
Individual line items in the checklist. See below.

checklist_item

A single line item within a checklist. Each item records the system category it belongs to, its name, and the observed value or condition.
id
Int
required
Auto-incremented primary key.
id_checklist
Int
required
Foreign key to the parent checklist.
sistema
String?
System or category the item belongs to (e.g. "Motor", "Carrocería").
nombre_item
String?
Name of the specific item being inspected.
valor
String?
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 the estado field of an expediente changes, providing a complete, timestamped history of the claim’s lifecycle.
id
Int
required
Auto-incremented primary key.
no_siniestro
String
required
Foreign key to the expediente whose status changed.
estado_anterior
estado_enum?
The estado value before the transition. Nullable to accommodate the initial state assignment on creation.
estado_nuevo
estado_enum
required
The estado value after the transition.
fecha_cambio
Timestamp
required
Exact timestamp of the state change. Defaults to now().
cambiado_por
Int?
Foreign key to the usuario who triggered the state change. Nullable for system-initiated transitions.

aseguradora

Insurance company records referenced by expedientes.
id
Int
required
Auto-incremented primary key.
nombre
String?
Name of the insurance company.
Optional binary logo image stored directly in the database.

usuario

System users who authenticate with the API.
id
Int
required
Auto-incremented primary key.
nombre
String?
Display name of the user.
username
String
required
Unique login username. Cannot contain whitespace. Used as the login credential and embedded in the JWT.
password_hash
String
required
bcrypt hash of the user’s password. Never returned in API responses.
rol
rol_enum
required
The user’s role — Administrador, Operador, or Tecnico. Drives all authorization decisions.

Enums

estado_enum
enum
Tracks the lifecycle stage of an expediente.
ValueMeaning
IngresoVehicle received, claim opened
RestauracionActively under repair
Pendiente_de_salidaRepair complete, awaiting collection
SalidaVehicle delivered, claim closed
rol_enum
enum
Defines which actions a usuario is permitted to perform.
ValueDescription
AdministradorFull system access
OperadorCreate and update expedientes and levantamientos; no destructive actions
TecnicoRead expedientes; create and update levantamientos; no destructive actions
ubicacion_enum
enum
Indicates where files or data are physically stored.
ValueDescription
LocalStored on the API server’s filesystem
NubeStored in cloud/remote storage

Relationships

The following diagram summarises the entity relationships in plain text:
aseguradora ──< expediente >── usuario

        ┌───────────┼──────────────┬──────────────┐
        │           │              │               │
    evidencia  checklist  levantamiento_danios  historial_estado
                   │                    │
            checklist_item   levantamiento_concepto
  • An expediente belongs to one aseguradora (nullable) and one usuario (the creator, nullable).
  • An expediente has many evidencia, checklist, levantamiento_danios, and historial_estado records.
  • A levantamiento_danios has many levantamiento_concepto line items.
  • A checklist has many checklist_item records.
  • A usuario is referenced by evidencia (uploader), expediente (creator), and historial_estado (who changed the state).
  • historial_estado appends a new row on every estado transition. Each row captures estado_anterior, estado_nuevo, fecha_cambio (defaults to now()), and cambiado_por (the user ID).

Build docs developers (and LLMs) love