From 1953d54dc5b82cc727f9ea4022edb8ec518a8764 Mon Sep 17 00:00:00 2001 From: ghotso Date: Tue, 19 Aug 2025 01:42:35 +0200 Subject: [PATCH] fix(types): refine user type definitions for assigned users in incident handling --- .../schedule-incident/incident/form/IncidentBasicFields.tsx | 2 +- application/src/services/incident/pdf/generator.ts | 2 +- application/src/services/incident/pdf/sections.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/src/components/schedule-incident/incident/form/IncidentBasicFields.tsx b/application/src/components/schedule-incident/incident/form/IncidentBasicFields.tsx index 7cb648b..3882595 100644 --- a/application/src/components/schedule-incident/incident/form/IncidentBasicFields.tsx +++ b/application/src/components/schedule-incident/incident/form/IncidentBasicFields.tsx @@ -68,7 +68,7 @@ export const IncidentBasicFields: React.FC = () => { const selectedUser = users.find(user => user.id === form.getValues('assigned_to')); // Function to get user initials from name - const getUserInitials = (user: any): string => { + const getUserInitials = (user: { full_name?: string; username: string }): string => { if (user.full_name) { const nameParts = user.full_name.split(' '); if (nameParts.length > 1) { diff --git a/application/src/services/incident/pdf/generator.ts b/application/src/services/incident/pdf/generator.ts index 6ffb398..d69b2a1 100644 --- a/application/src/services/incident/pdf/generator.ts +++ b/application/src/services/incident/pdf/generator.ts @@ -24,7 +24,7 @@ export const generatePdf = async (incident: IncidentItem): Promise => { } // Fetch assigned user data if available - let assignedUser = null; + let assignedUser: { full_name?: string; username?: string } | null = null; const assigneeId = incident?.assigned_users || incident?.assigned_to; if (assigneeId) { try { diff --git a/application/src/services/incident/pdf/sections.ts b/application/src/services/incident/pdf/sections.ts index 3f5b464..59c43cf 100644 --- a/application/src/services/incident/pdf/sections.ts +++ b/application/src/services/incident/pdf/sections.ts @@ -146,7 +146,7 @@ export const addResolutionSection = (doc: jsPDF, incident: IncidentItem, yPos: n /** * Add the assignment information section to the PDF */ -export const addAssignmentSection = (doc: jsPDF, incident: IncidentItem, yPos: number, assignedUser?: any): number => { +export const addAssignmentSection = (doc: jsPDF, incident: IncidentItem, yPos: number, assignedUser?: { full_name?: string; username?: string } | null): number => { doc.setFontSize(14); doc.setTextColor(30, 64, 175); // Blue-800 doc.text('Assignment Information', 15, yPos);