Skip to main content

Documentation 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.

The audit log captures a record of every significant action performed in Inventario SUD. Each entry stores what was done, who did it, when it happened, and the IP address the request came from. This gives your leadership team a complete, tamper-proof accountability trail for all inventory activity without relying on memory or manual notes.

Accessing the audit log

Navigate to Auditoría in the sidebar. The page loads all log entries ordered by most recent first, with each row showing the action description, the user’s name and role, the timestamp, and the IP address.

Log schema

The audit log is stored in the Auditoria_log table. The Drizzle schema is defined in lib/schema.ts.
export const auditoriaLogs = pgTable("Auditoria_log", {
  id_log: serial("id_log").primaryKey(),
  accion_realizada: varchar("accion_realizada", { length: 255 }).notNull(),
  fecha_hora: timestamp("fecha_hora").defaultNow().notNull(),
  direccion_ip: varchar("direccion_ip", { length: 45 }),
  id_usuario: integer("id_usuario")
    .notNull()
    .references(() => usuarios.id_usuario),
});
FieldTypeDescription
id_logserialAuto-incrementing primary key.
accion_realizadavarcharHuman-readable description of the action that was performed.
fecha_horatimestampServer timestamp set automatically when the record is inserted.
direccion_ipvarcharIP address of the client that made the request. Up to 45 characters to support IPv6.
id_usuariointegerForeign key referencing the Usuario who performed the action.

What gets logged

The following actions are written to the audit log automatically:
  • Asset management — registering a new asset, editing asset details, soft-deleting an asset
  • Consumable management — registering a new consumable, editing quantity or details, soft-deleting a consumable
  • Loan management — creating a new loan, editing loan details, cancelling (soft-deleting) a loan
  • User management — creating a new user account, deleting a user account
  • Biometric calibration — registering or updating a user’s facial biometric vector

Append-only design

The audit log is append-only. No user, including an Obispo, can edit or delete log entries through the application UI. The Auditoria_log table has no soft-delete flag and no update action is exposed through any server action or API route. Entries remain permanent unless removed directly at the database level by a database administrator.
The IP address stored in each log entry is read from the x-forwarded-for request header first, then falls back to x-real-ip. If your deployment sits behind a reverse proxy or load balancer, ensure the proxy forwards the real client IP in one of these headers so the logged address reflects the actual user rather than the proxy.

Build docs developers (and LLMs) love