Saltar a contenido

Línea de Tiempo de Fichajes

GET /api/v2/timerecord/timeline

Método/Ruta: GET /api/v2/timerecord/timeline
Auth: Bearer JWT

Descripción: Obtiene la línea de tiempo del día actual con todas las entradas y salidas ordenadas cronológicamente (más reciente primero).

Params

(sin parámetros)

cURL

curl -X GET "http://localhost:7001/api/v2/timerecord/timeline" \
  -H "Authorization: Bearer <TOKEN>"

Response (200)

{
  "status": "success",
  "data": [
    {
      "fullName": "Juan López",
      "action": "exit",
      "time": "2026-01-07T17:30:00.000Z",
      "source": "system",
      "deviceId": null
    },
    {
      "fullName": "Juan López",
      "action": "entry",
      "time": "2026-01-07T14:00:00.000Z",
      "source": "app",
      "deviceId": "iphone-123"
    },
    {
      "fullName": "Elena Ruiz",
      "action": "exit",
      "time": "2026-01-07T13:00:00.000Z",
      "source": "web",
      "deviceId": "browser-456"
    },
    {
      "fullName": "Elena Ruiz",
      "action": "entry",
      "time": "2026-01-07T09:00:00.000Z",
      "source": "web",
      "deviceId": "browser-456"
    },
    {
      "fullName": "María García",
      "action": "entry",
      "time": "2026-01-07T08:00:00.000Z",
      "source": null,
      "deviceId": null
    }
  ]
}

Response Fields

Campo Tipo Descripción
fullName string Nombre completo del empleado
action string "entry" (entrada) o "exit" (salida)
time Date Hora del evento
source string | null Origen del fichaje: "web", "app", "system" (cierre automático), o null si no se registró
deviceId string | null ID del dispositivo, o null si no se registró

Errores

Código Descripción
401 Token inválido o expirado

Notas

  • Los eventos se ordenan por hora descendente (más reciente primero)
  • Solo se muestran fichajes con entrada real (donde el usuario fichó). Los registros creados automáticamente por el sistema (solo systemStart) no aparecen en el timeline
  • Cada fichaje puede generar 1 o 2 eventos: siempre genera entrada, y si está cerrado también genera salida
  • Cuando source es "system" en una salida, significa que el sistema cerró el fichaje automáticamente (el usuario no fichó salida)
  • El timezone de referencia es Europe/Madrid