The Equipment API manages the two primary asset types in the inventory — PC and Laptop. Each equipment record embeds an array of internal components (processor, RAM, hard drive, motherboard) and an array of attached peripherals. Every piece of equipment carries two location objects:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Danielings/Pasantia-Proyecto/llms.txt
Use this file to discover all available pages before exploring further.
procedencia (where the asset originated) and asignacion (where it is currently deployed). Serial uniqueness is enforced globally via an indices collection, so the same serial cannot appear in more than one equipment, component, or peripheral record across the entire system.
POST /api/pc
Register a new PC in the inventory. The request is processed inside a Firestore transaction that validates serial uniqueness, normalizes location data, creates the equipment document, and synchronizes any embedded peripherals with the standaloneperifericos collection.
Auth: Not required.
Request
Equipment brand (e.g.,
"HP", "Dell").Equipment model name.
Unique serial number. Must not already exist in the indices collection.
Current condition of the equipment (e.g.,
"Bueno", "Regular", "Dañado").Free-text observations. Stored as
null if omitted.Origin location. Must include
region, estado, ciudad, sede, piso. Optionally ala.Deployment location. Same structure as
procedencia.Array of internal component objects. Each item must include:
tipo(string, required): One ofProcesador,Memoria_RAM,Disco_Duro,Motherboard. Partial matches like"ram"or"disco"are auto-mapped.marca(string): Defaults to"Genérico"if blank.modelo(string): Defaults to"Genérico"if blank.serial(string, required): Unique serial for the component.estado(string, required): Component condition.capacidad(string): Required whentipoisMemoria_RAMorDisco_Duro.
Array of peripheral objects. Each item must include:
tipo(string, required): One ofMonitor,Teclado,Mouse,Switch,Impresora,Corneta.marca(string): Defaults to"Genérico"if blank.modelo(string): Defaults to"Genérico"if blank.serial(string, required): Unique serial. If the serial already exists inperifericosand is unassigned, the existing document is linked instead of creating a new one.estado(string, required): Peripheral condition.
Response
"PC REGISTRADA CON ÉXITO."Firestore document ID of the new equipment record.
Example
POST /api/laptop
Register a new Laptop in the inventory. Identical request shape and behavior asPOST /api/pc — the only difference is the stored tipo field is set to "Laptop".
Auth: Not required.
Request
Same body fields asPOST /api/pc. See above for the full parameter reference.
Response
"LAPTOP REGISTRADA CON ÉXITO."Firestore document ID of the new laptop record.
Example
GET /api/equipos
List all equipment records. Results are scoped by the authenticated user’ssede unless the user holds the Superadministrador role, in which case all records are returned. Supports filtering by type, status, and serial number via query parameters.
Auth: Required.
Request
Filter by equipment type. Accepts
"PC" or "Laptop" (case-insensitive, normalized internally).Filter by condition (e.g.,
"Bueno", "Dañado").Filter by exact serial number match (normalized comparison).
Response
Returns a JSON array of full equipment objects. Each element includes:Firestore document ID.
"PC" or "Laptop".Equipment brand.
Equipment model.
Serial number.
Current condition.
Origin location object with
region, estado, ciudad, sede, piso, ala.Deployment location object with the same structure as
procedencia.Array of embedded component objects.
Array of embedded peripheral objects.
Example
GET /api/equipos/lista
Returns a lightweight list of all equipment suitable for populating dropdowns or selection fields. No authentication required. Auth: Not required.Request
No parameters.Response
Returns a JSON array. Each element contains only the identifying fields:Firestore document ID.
Serial number.
Brand.
Model.
"PC" or "Laptop".Example
GET /api/equipos/:id
Retrieve a single equipment record by its Firestore document ID. Auth: Not required.Request
Firestore document ID of the equipment record.
Response
Returns the full equipment document including all embeddedcomponentes and perifericos arrays. Returns 404 if the document does not exist.
Example
PUT /api/equipos/:id
Update an existing equipment record. Accepts any combination of top-level fields (marca, modelo, serial, estado, tipo) as well as componentes[] and perifericos[] arrays. Peripheral changes are fully synchronized with the standalone perifericos collection and the indices collection — removed peripherals are unlinked and added peripherals are linked or created as needed.
Auth: Not required.
The
notas field is not updated by this endpoint. The Firestore update() call does not include notas in its payload, so the existing value is always preserved. To change notas, delete and re-register the equipment.The
componentes array uses a merge strategy: existing components whose serials are present in the new payload are updated in place; components not in the new payload are removed. Send the full desired component list on each request.Request
Firestore document ID of the equipment to update.
Updated brand.
Updated model.
Updated serial number.
Updated condition.
Updated type (
"PC" or "Laptop").Full list of component objects to set on the equipment. Omit to leave components unchanged. Each item follows the same structure as in
POST /api/pc.Full list of peripheral objects to set on the equipment. Peripherals removed from this list are automatically unassigned in their standalone documents.
Updated deployment region.
Updated deployment state (use this field rather than
estado when updating location to avoid ambiguity with equipment condition).Updated deployment city.
Updated deployment office.
Updated deployment floor.
Updated deployment wing. The source also accepts
ala as an alias for the same field.Response
"Equipo actualizado correctamente."Firestore document ID of the updated equipment.
Example
GET /api/equipo/:id
Alternative single-equipment retrieval endpoint. Guarantees thatcomponentes and perifericos are always arrays (defaulting to [] if the fields are absent in Firestore), making it safe to iterate without a null check on the client.
Auth: Not required.
Request
Firestore document ID of the equipment.
Response
Full equipment document withcomponentes: [] and perifericos: [] guaranteed. Returns 404 if the document does not exist.
Example
GET /api/buscar/:serial
Search for a piece of equipment by its serial number. The comparison is normalized (case-insensitive, accent-insensitive), so"MXL1234567" matches "mxl1234567". Returns the first match found.
Auth: Not required.
Request
Serial number to search for.
Response
Returns the full equipment document on success. Returns404 with { "message": "Equipo no encontrado" } if no match is found.
Example
GET /api/:dispositivo/:id
Check whether a serial number exists in the globalindices collection for a given device type. Returns an array containing { serial } if the serial is found, or an empty array if it is not. This endpoint is used internally to pre-populate form fields and avoid duplicate serial entry.
Auth: Not required.
The
:id path segment is treated as a serial number, not a Firestore document ID. The route resolves the appropriate index prefix (equipo, periferico, or componente) based on the :dispositivo value and then queries the indices collection. Unrecognized device types fall through to the next middleware (Express next()).Request
Device type. Accepted values: equipment types (
pc, laptop), peripheral types (monitor, teclado, mouse, switch, impresora, corneta), or component types (procesador, memoria_ram, disco_duro, motherboard). Case-insensitive.Serial number to look up.
Response
Returns a JSON array:[{ "serial": "<value>" }]— the serial is registered in the indices collection.[]— the serial is not registered.
Example
GET /api/verificar-periferico/:dispositivo/:serial
Check whether a specific peripheral or component serial number is already registered and assigned. Useful for pre-validating a serial before submitting a registration form. Auth: Not required.Request
Device type to check. Accepts peripheral types (
monitor, teclado, mouse, switch, impresora, corneta) or component types (procesador, memoria_ram, disco_duro, motherboard). Case-insensitive.Serial number to look up in the indices collection.
Response
true if the serial is registered in the system.true if the serial is currently linked to an equipment record.Type of the linked equipment (e.g.,
"PC"). Present only when asignado is true.Serial number of the linked equipment. Present only when
asignado is true.Human-readable description of the result.