Skip to main content

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.

The Audit Log API exposes the complete history of system events recorded in the bitacora Firestore collection. Every significant action in the Sistema de Inventario Tecnológico — successful logins, user profile updates, user deactivations, and location soft-deletes — is automatically logged by the respective endpoint handler. Entries are returned newest-first, ordered by the fecha field descending.

GET /api/bitacora

Retrieve all audit log entries ordered from most recent to oldest. Auth: Not required.
The bitácora is a cumulative append-only log. Entries are never modified or deleted by the API. Each write operation in the system appends a new document; the log grows monotonically over time.

Request

No request body or query parameters. All available entries are returned in a single response.

Response

Returns a JSON array of bitácora entries. Each element contains:
id
string
Firestore auto-generated document ID for the audit entry.
accion
string
Label describing the type of event. Known values include:
  • "Login" — Successful authentication.
  • "Actualización de usuario" — One or more profile fields were changed via PUT /api/usuarios/:id.
  • "Eliminar usuario" — A user account was soft-deleted via PUT /api/usuarios/eliminado/:id.
  • "Eliminar ubicación" — A location was soft-deleted via PUT /api/ubicaciones/eliminadas/:id.
detalles
array
Array of strings describing the individual changes that occurred. For login events this will be ["Inicio de Sesión"]. For update events it lists each changed field, for example ["nombre: Juan → Carlos", "piso: 3 → 4"].
fecha
string | null
ISO 8601 UTC timestamp of when the event occurred (e.g., "2024-06-15T14:32:00.000Z"). null if the Firestore timestamp could not be converted.
id_modificado
string
Firestore document ID of the record that was affected. For login events this is 0 (no specific record was modified).
sede
string
Office (sede) of the user who performed the action. "N/A" if the sede could not be determined.
usuario
string
Username of the actor who triggered the event. "Desconocido" if unavailable.

Example

curl http://localhost:3001/api/bitacora
[
  {
    "id": "bXk92mNpQrSt",
    "accion": "Actualización de usuario",
    "detalles": [
      "telefono: 0414-1234567 → 0414-9999999",
      "piso: 3 → 4"
    ],
    "fecha": "2024-06-15T14:32:00.000Z",
    "id_modificado": "abc123",
    "sede": "Torre Norte",
    "usuario": "jperez"
  },
  {
    "id": "aYj81lMoNqRs",
    "accion": "Eliminar usuario",
    "detalles": [
      "Se inactivó al usuario: mgomez"
    ],
    "fecha": "2024-06-14T09:15:00.000Z",
    "id_modificado": "def456",
    "sede": "Oficina Central",
    "usuario": "admin"
  },
  {
    "id": "zXi70kLnMpQr",
    "accion": "Login",
    "detalles": [
      "Inicio de Sesión"
    ],
    "fecha": "2024-06-14T08:00:00.000Z",
    "id_modificado": "0",
    "sede": "Torre Norte",
    "usuario": "jperez"
  }
]

Build docs developers (and LLMs) love