Ir al contenido

Incidencias

interface IncidentType {
id: string;
name: string; // "Retraso", "Ausencia", "Falta leve", "Falta grave"
code: string; // "RET", "AUS", "FLV", "FGR"
category: 'attendance' | 'conduct' | 'safety' | 'performance';
severity: 1 | 2 | 3 | 4 | 5; // 1=menor, 5=grave
requires_documentation: boolean;
deduct_from_payroll: boolean;
active: boolean;
}
GET /api/hr/incident-types
POST /api/hr/incident-types
PATCH /api/hr/incident-types/:id
DELETE /api/hr/incident-types/:id
[
{ "name": "Retraso", "code": "RET", "category": "attendance", "severity": 1 },
{ "name": "Ausencia injustificada", "code": "AUS", "category": "attendance", "severity": 3 },
{ "name": "Incumplimiento seguridad", "code": "SEG", "category": "safety", "severity": 5 }
]

interface Incident {
id: string;
employee_id: string;
incident_type_id: string;
date: string;
description: string;
duration_minutes?: number; // Para ausencias/retrasos
documentation_url?: string; // PDF del parte
reported_by: string;
status: 'reported' | 'under_review' | 'resolved' | 'escalated';
action_taken?: string;
disciplinary_action?: string;
created_at: string;
resolved_at?: string;
}
Método Ruta Descripción
GET /api/hr/incidents Listar incidencias
POST /api/hr/incidents Registrar incidencia
GET /api/hr/incidents/:id Ver incidencia
PATCH /api/hr/incidents/:id Actualizar incidencia
POST /api/hr/incidents/:id/resolve Resolver incidencia
DELETE /api/hr/incidents/:id Eliminar incidencia
POST /api/hr/incidents
Authorization: Bearer <token>
Content-Type: application/json
{
"employee_id": "emp_001",
"incident_type_id": "inc_ret",
"date": "2026-05-07",
"description": "Llegada 25 minutos tarde sin justificacion",
"duration_minutes": 25,
"reported_by": "emp_003"
}
GET /api/hr/incidents?employee_id=emp_001&from=2026-01-01&to=2026-12-31
GET /api/hr/reports/incidents?from=2026-01-01&to=2026-06-30
{
"total_incidents": 12,
"by_type": [
{ "type": "Retraso", "count": 7 },
{ "type": "Ausencia", "count": 5 }
],
"by_employee": [
{ "employee": "Carlos Martinez", "count": 5, "severity": "high" }
],
"incidents_cost": 450.00
}

Método Ruta Descripción
GET /api/hr/incident-types Listar tipos de incidencia
POST /api/hr/incident-types Crear tipo de incidencia
PATCH /api/hr/incident-types/:id Editar tipo
DELETE /api/hr/incident-types/:id Eliminar tipo
GET /api/hr/incidents Listar incidencias
POST /api/hr/incidents Registrar incidencia
GET /api/hr/incidents/:id Ver incidencia
PATCH /api/hr/incidents/:id Actualizar incidencia
POST /api/hr/incidents/:id/resolve Resolver incidencia
GET /api/hr/reports/incidents Informe de incidencias