Peripherals in the inventory system can live in two states: standalone (registered in theDocumentation 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.
perifericos Firestore collection but not linked to any PC or Laptop) or assigned (linked to a specific equipment record via equipoId). This design allows you to track peripherals from the moment they arrive in the warehouse, before they are ever attached to a machine. The same serial-uniqueness guarantee that protects equipment serials also applies to every peripheral serial.
Peripheral Types
The system recognizes the following peripheral types, defined ininventory.constants.js:
:tipo) is normalized before lookup, so /api/perifericos/Monitor, /api/perifericos/monitor, and /api/perifericos/MONITOR all resolve correctly.
Registering a Standalone Peripheral
POST /api/perifericos/:tipo
Choose the peripheral type
Use one of the keys from
PERIFERICOS_MAP as the URL segment — for example /api/perifericos/monitor.Build the request body
Provide
serial, modelo, estado, and optionally marca, notas, procedencia, and asignacion. The peripheral starts as asignado: false with equipoId: null.Frontend Validation Schema
The frontend validates peripheral forms using Zod (perifericoSchema.ts) before sending data:
Retrieving a Peripheral
GET /api/perifericos/:id
Returns the full peripheral document. If the peripheral is currently embedded in an equipment’s perifericos array (matched by serial), the response also includes an equipoRelacionado object:
asignado is false, equipoRelacionado is null.
Updating a Peripheral
PUT /api/perifericos/:tipo/:id
This endpoint handles three scenarios in a single transaction:
Update fields only (no reassignment)
Update fields only (no reassignment)
Omit
asignadoA entirely. The handler updates marca, modelo, serial, estado, notas, and asignacion (if ubicacion is provided) while preserving procedencia as-is.Reassign to a different equipment
Reassign to a different equipment
Pass the target equipment’s Firestore document ID in
asignadoA. The handler:- Removes the peripheral from the old equipment’s
perifericosarray. - Adds it to the new equipment’s
perifericosarray. - Updates the
perifericosdocument with the newequipoId,equipoSerial, andequipoRelacionado.
Unassign (return to standalone)
Unassign (return to standalone)
Pass
"desvincular" (or an empty string "") in asignadoA. The peripheral is removed from the equipment’s array and its asignado flag is set back to false.One-Per-Type Constraint
The backend enforces that each equipment record may have at most one peripheral of each type. Before adding a peripheral to an equipment during a PUT, the handler inspects the existingperifericos array:
Listing All Components and Peripherals
GET /api/componentes — requires authentication.
Returns a flat array of all equipment and standalone peripherals with their location fields resolved. The response shape is:
Role-based scoping: Superadministrador users see all items across every office. All other roles only see items where
asignacion.sede (or the legacy sede field) matches their own assigned office. Users with no sede on their account receive an empty array.Verifying a Serial Before Registration
GET /api/verificar-periferico/:dispositivo/:serial
Use this endpoint to check whether a serial is already in use before displaying the registration form. The :dispositivo parameter accepts any key from PERIFERICOS_MAP or COMPONENTES_MAP.