Incidencias
Tipos de incidencia
Modelo
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;}Endpoints
GET /api/hr/incident-typesPOST /api/hr/incident-typesPATCH /api/hr/incident-types/:idDELETE /api/hr/incident-types/:idEjemplos
[ { "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 }]Incidencias registradas
Modelo
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;}Endpoints
| Metodo | Ruta | Descripcion |
|---|---|---|
| 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 |
Registrar incidencia
POST /api/hr/incidentsAuthorization: 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"}Listar incidencias de un empleado
GET /api/hr/incidents?employee_id=emp_001&from=2026-01-01&to=2026-12-31Informe de incidencias por periodo
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}Resumen de endpoints
| Metodo | Ruta | Descripcion |
|---|---|---|
| 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 |