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.

A levantamiento de daños is a damage survey linked to an expediente. It captures the vehicle’s physical condition at the time of inspection — which systems are damaged, identifying details like mileage and VIN, and the owner’s contact information — and contains an ordered list of cost conceptos (line items) representing each discrete repair task. The sum of all concept costs gives you the total repair estimate for that survey.
A single expediente can have multiple levantamientos. A common scenario is an initial survey at intake followed by a supplementary survey after disassembly reveals hidden damage. Each survey has its own independent list of cost concepts.

Creating a levantamiento

POST /api/levantamientos The only required field is no_siniestro, which must match an existing expediente. All other fields are optional and can be updated later with PUT /api/levantamientos/:id. Any authenticated user may create a levantamiento — this endpoint requires a valid token (verificarToken) but has no role restriction beyond that. Vehicle detail fields:
FieldTypeDescription
fechastringInspection date. Accepts DD/MM/YYYY or YYYY-MM-DD.
ordenstringWork order number.
marcastringVehicle make (e.g. Toyota).
tipostringBody type (e.g. Sedan).
modelostringModel name (e.g. Corolla).
placasstringLicense plate.
kilometrajestringOdometer reading at inspection.
no_puertasstringNumber of doors.
colorstringVehicle color.
seriestringVIN / chassis serial number.
ecostringFleet / eco number (if applicable).
nombre_propietariostringOwner’s name.
telefonostringOwner’s phone number.
direccionstringOwner’s address.
Damage boolean fields — set to true for each system that is damaged:
FieldSystem
cristalesGlass / windows
aireAir conditioning
vestidurasUpholstery / interior trim
rinWheels / rims
direccion_vehSteering system
tipo_pinturaPaint type affected
trasmisionTransmission
curl -X POST http://localhost:3000/api/levantamientos \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "no_siniestro": "SIN-2024-001",
    "marca": "Toyota",
    "modelo": "Corolla",
    "fecha": "2024-01-15",
    "cristales": true,
    "aire": false
  }'
Success response201 Created:
{
  "id": 42,
  "no_siniestro": "SIN-2024-001",
  "marca": "Toyota",
  "modelo": "Corolla",
  "fecha": "2024-01-15T12:00:00.000Z",
  "cristales": true,
  "aire": false,
  "levantamiento_concepto": []
}
Returns 400 if no_siniestro is missing or does not match any existing expediente.

Adding cost concepts

POST /api/levantamientos/:id/conceptos Add a line-item repair cost to an existing levantamiento. Each concept represents one discrete repair task or part replacement.
FieldRequiredDescription
conceptoHuman-readable description of the repair item.
clavesInternal item code or parts catalogue key.
costoCost in decimal currency (stored as Decimal in the database).
curl -X POST http://localhost:3000/api/levantamientos/42/conceptos \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "concepto": "Cambio de parabrisas",
    "claves": "CR-001",
    "costo": 3500.00
  }'
Success response201 Created:
{
  "id": 101,
  "id_levantamiento": 42,
  "claves": "CR-001",
  "concepto": "Cambio de parabrisas",
  "costo": "3500.00"
}
Returns 404 if the levantamiento with the given id does not exist, and 400 if concepto is omitted.

Calculating the total cost

GET /api/levantamientos/:id/costo-total Returns the sum of all costo values across every concept belonging to the levantamiento. Useful for displaying a quick repair estimate without fetching the full concept list.
curl http://localhost:3000/api/levantamientos/42/costo-total \
  -H "Authorization: Bearer $TOKEN"
Response:
{
  "id_levantamiento": 42,
  "total": 3500
}
total is a plain JavaScript number (the result of summing each concept’s costo cast to Number). Returns 404 if the levantamiento does not exist.

Fetching levantamientos

List all (with optional filter)

GET /api/levantamientosReturns all levantamientos, each with its levantamiento_concepto array included, ordered by id descending.Filter by claim using the optional query parameter:GET /api/levantamientos?no_siniestro=SIN-2024-001

Get by ID

GET /api/levantamientos/:idReturns a single levantamiento by its numeric id, including its concepts and the linked expediente object. Returns 404 if not found.

Get by siniestro

GET /api/levantamientos/siniestro/:no_siniestroReturns the most recent levantamiento for the given no_siniestro (ordered by id descending), including its concepts. Returns 404 if none exists.

Updating a levantamiento

PUT /api/levantamientos/:id Performs a partial update on the levantamiento’s own fields. Only include the fields you want to change; all others remain unchanged. The fecha field accepts the same DD/MM/YYYY or YYYY-MM-DD formats as on creation. Any authenticated user may call this endpoint.
curl -X PUT http://localhost:3000/api/levantamientos/42 \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "kilometraje": "45320",
    "rin": true
  }'
Returns the updated levantamiento with its concepts. Returns 404 if not found.

Deleting levantamientos and concepts

Both deletion endpoints require the Administrador role.

Delete a levantamiento

DELETE /api/levantamientos/:idDeletes the levantamiento and all its concepts in a single transaction.
curl -X DELETE http://localhost:3000/api/levantamientos/42 \
  -H "Authorization: Bearer $TOKEN"
Response:
{ "mensaje": "Levantamiento y conceptos eliminados correctamente" }

Delete a single concept

DELETE /api/levantamientos/conceptos/:id_conceptoRemoves one line-item concept without affecting the parent levantamiento or its other concepts.
curl -X DELETE http://localhost:3000/api/levantamientos/conceptos/101 \
  -H "Authorization: Bearer $TOKEN"
Response:
{ "mensaje": "Concepto eliminado correctamente" }

Build docs developers (and LLMs) love