Inventario SUD uses Drizzle ORM with a Neon PostgreSQL database. The schema is defined inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/ChrisCore1/inventario_sud/llms.txt
Use this file to discover all available pages before exploring further.
lib/schema.ts and covers roles, users, inventory items, consumables, loans, audit logs, and password resets. The biometria field on the Usuario table uses the pgvector extension — you must enable it in your Neon project before biometric login will work.
pgvector extension
The
biometria column is of type vector(1024), which requires the pgvector extension to be enabled in your PostgreSQL instance. In Neon, you can enable it by running CREATE EXTENSION IF NOT EXISTS vector; in the SQL editor of your project dashboard. Without this extension, the schema migration will fail.<=> operator is the pgvector cosine distance operator. A similarity value close to 1.0 means the vectors are nearly identical.
Tables
Rol
Stores the access roles that can be assigned to users (for example,Obispo, Consejero).
Auto-incrementing primary key.
Unique name for the role, such as
Obispo or Consejero.Usuario
Stores system users. Each user is assigned exactly one role and may optionally have a biometric embedding stored for facial recognition login.Auto-incrementing primary key.
Display name of the user.
Unique email address used for login and password reset.
bcrypt hash of the user’s password.
Whether the account is active. Defaults to
true. Set to false to disable login without deleting the record.1024-dimensional facial recognition embedding generated by
@vladmandic/human. Requires the pgvector extension. Null when biometric login has not been enrolled.Foreign key referencing
Rol.id_rol.Categoria
Lookup table for item categories shared by bothArticulo and Consumible.
Auto-incrementing primary key.
Unique category name, such as
Mobiliario or Electrónica.Ubicacion
Lookup table for physical locations within the facility.Auto-incrementing primary key.
Human-readable location name, such as
Salón Principal or Almacén.Articulo
Tracks fixed assets (non-consumable items). Supports soft delete viais_deleted.
Auto-incrementing primary key.
Name of the asset.
Total quantity of this asset. Defaults to
0.Physical condition of the asset. Expected values:
Bueno, Regular, Dañado.Availability status. Expected values:
Disponible, Prestado, No Disponible, Agotado/Baja.Soft-delete flag. When
true, the asset is hidden from the UI but retained in the database. Defaults to false.Foreign key referencing
Categoria.id_categoria.Foreign key referencing
Ubicacion.id_ubicacion.Consumible
Tracks consumable supplies with minimum-stock thresholds.Auto-incrementing primary key.
Name of the consumable item.
Current stock quantity. Defaults to
0.Minimum stock threshold. The dashboard surfaces a low-stock alert when
cantidad falls at or below this value. Defaults to 0.Unit of measure (for example,
uds, kg, litros). Defaults to uds.Soft-delete flag. Defaults to
false.Foreign key referencing
Categoria.id_categoria.Foreign key referencing
Ubicacion.id_ubicacion.Movimiento_Prestamos
Records equipment loans, linking a user who authorized the loan to a specific asset.Auto-incrementing primary key.
Number of units lent. Defaults to
1.Name of the person who authorized the loan.
Destination or purpose of the loan.
Date and time the loan started.
Expected return date and time. Null if no return date has been set.
Name of the external person responsible for the loaned item.
Soft-delete flag. Defaults to
false.Foreign key referencing
Usuario.id_usuario — the internal user who registered the loan.Foreign key referencing
Articulo.id_articulo — the asset being lent.Auditoria_log
Append-only audit trail. Every significant action in the system writes a row here automatically.Auto-incrementing primary key.
Human-readable description of the action performed (for example,
Creó artículo: Silla plegable).Timestamp of the action. Defaults to
now().IP address of the request. Supports both IPv4 and IPv6 addresses.
Foreign key referencing
Usuario.id_usuario — the user who performed the action.password_resets
Temporary table for time-limited PIN codes used in the password reset flow. Rows are deleted after a successful reset or when a new PIN is requested for the same email.Auto-incrementing primary key.
Email address the reset PIN was sent to.
Six-digit numeric PIN delivered by email. Valid for 10 minutes.
Timestamp when the PIN was created. Defaults to
now().Timestamp after which the PIN is considered expired.
