Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AC42027/Backend-produccion/llms.txt

Use this file to discover all available pages before exploring further.

Equipment in the Inspecciones Técnicas system is organized within a three-level plant location hierarchy (Division → Area → Zona) and enriched with an optional physical location description, a responsible owner, and a category that determines which technical questions apply during an inspection. This page documents each model, its fields, and how the pieces fit together.

Categoria

Categoria groups both PreguntaTecnica checklist questions and Equipo records. When a technician begins an inspection, the equipment’s category determines which questions are loaded.
FieldTypeConstraintsDescription
idintegerPK, autoPrimary key
nombrestring (100)requiredCategory name

PreguntaTecnica

PreguntaTecnica defines a reusable checklist question. Questions are scoped to a Categoria and ordered within it by the orden field.
FieldTypeConstraintsDescription
idintegerPK, autoPrimary key
descripcionstring (255)requiredThe question text shown to the technician
categoriaFK → Categoriarequired, CASCADEThe category this question belongs to
ordenpositive integerdefault 0Display position within the category
The combination of (categoria, orden) is unique. The default query ordering is categoria__nombre, then orden, then descripcion, so questions are consistently sequenced without any additional sorting in the API layer.

Division

Division is the top level of the plant location hierarchy.
FieldTypeConstraintsDescription
idintegerPK, autoPrimary key
nombrestring (100)requiredDivision name

Area

Area is the second level of the hierarchy. Every area belongs to exactly one division.
FieldTypeConstraintsDescription
idintegerPK, autoPrimary key
nombrestring (100)requiredArea name
divisionFK → Divisionrequired, CASCADEThe division this area belongs to
Deleting a Division cascades and removes all of its Area records.

Zona

Zona is the third and most granular level of the hierarchy. Every zone belongs to exactly one area.
FieldTypeConstraintsDescription
idintegerPK, autoPrimary key
nombrestring (100)requiredZone name
areaFK → Arearequired, CASCADEThe area this zone belongs to
Deleting an Area cascades and removes all of its Zona records.

UbicacionFisica

UbicacionFisica holds a freeform physical location description — for example, a specific bay, room, or installation point. It is separate from the Division → Area → Zona hierarchy and is assigned directly to an Equipo.
FieldTypeConstraintsDescription
idintegerPK, autoPrimary key
descripcionstring (255)requiredHuman-readable location description

Owner

Owner represents the responsible party for one or more equipment items. This is typically a maintenance team or a named individual.
FieldTypeConstraintsDescription
idintegerPK, autoPrimary key
nombrestring (100)requiredOwner name
descripciontextoptional, nullableExtended description or notes
Owner has a equipos reverse relation that returns all Equipo records assigned to it.

Equipo

Equipo is the central equipment record. It carries its full location context directly — division, area, and zona are denormalized onto the record so that queries and API responses do not need to traverse the location hierarchy.
FieldTypeConstraintsDescription
idintegerPK, autoPrimary key
nombrestring (100)requiredEquipment name
ubicacionFK → UbicacionFisicaoptional, SET NULLPhysical location description
categoriaFK → Categoriaoptional, SET NULLEquipment category (determines checklist)
divisionFK → Divisionoptional, SET NULLPlant division
areaFK → Areaoptional, SET NULLPlant area
zonaFK → Zonaoptional, SET NULLPlant zone
ownerFK → Owneroptional, SET NULLResponsible party
All foreign keys on Equipo use SET NULL on delete. Removing a location or owner record clears the reference on the equipment but does not delete the equipment itself.
The listar_equipos endpoint returns all related fields as resolved names alongside their IDs. For example, you receive both "categoria": "Montacargas" and "categoria_id": 3 in the same response object, which removes the need for secondary lookups when building a UI.

How they relate

Division
└── Area (FK → Division)
    └── Zona (FK → Area)

Categoria ──────────────── PreguntaTecnica (FK → Categoria, ordered by orden)

UbicacionFisica ─┐
Categoria ───────┤
Division ────────┤──► Equipo
Area ────────────┤
Zona ────────────┤
Owner ───────────┘
An inspection session (Inspeccion) inherits this location context — it holds its own division, area, zona, and equipo foreign keys copied from the equipment record at the time the inspection is submitted.

Build docs developers (and LLMs) love