Fix TypeScript compilation errors

- Add searchReference to ApplicationListItem type
- Fix result variable in toApplicationDetails function
- Add query helper functions for req.query parameter handling
- Fix req.query.* type errors in routes (applications, cache, classifications, objects)
- Fix CompletenessCategoryConfig missing id property
- Fix number | null type errors in dataService
- Add utils/queryHelpers.ts for reusable query parameter helpers
This commit is contained in:
2026-01-14 16:36:22 +01:00
parent fb7dd23027
commit 81d477ec8c
13 changed files with 1166 additions and 58 deletions

View File

@@ -289,19 +289,18 @@ async function toApplicationDetails(app: ApplicationComponent): Promise<Applicat
};
// Calculate data completeness percentage
// Convert ApplicationListItem-like structure to format expected by completeness calculator
// Convert ApplicationDetails-like structure to format expected by completeness calculator
const appForCompleteness = {
...result,
organisation: organisation?.name || null,
applicationFunctions: result.applicationFunctions,
status: result.status,
applicationFunctions: applicationFunctions,
status: (app.status || 'In Production') as ApplicationStatus,
businessImpactAnalyse: businessImpactAnalyse,
hostingType: hostingType,
supplierProduct: result.supplierProduct,
businessOwner: result.businessOwner,
systemOwner: result.systemOwner,
functionalApplicationManagement: result.functionalApplicationManagement,
technicalApplicationManagement: result.technicalApplicationManagement,
supplierProduct: extractLabel(app.supplierProduct),
businessOwner: extractLabel(app.businessOwner),
systemOwner: extractLabel(app.systemOwner),
functionalApplicationManagement: app.functionalApplicationManagement || null,
technicalApplicationManagement: extractLabel(app.technicalApplicationManagement),
governanceModel: governanceModel,
applicationType: applicationType,
applicationManagementHosting: applicationManagementHosting,
@@ -314,7 +313,48 @@ async function toApplicationDetails(app: ApplicationComponent): Promise<Applicat
const completenessPercentage = calculateApplicationCompleteness(appForCompleteness);
return {
...result,
id: app.id,
key: app.objectKey,
name: app.label,
description: app.description || null,
status: (app.status || 'In Production') as ApplicationStatus,
searchReference: app.searchReference || null,
// Organization info
organisation: organisation?.name || null,
businessOwner: extractLabel(app.businessOwner),
systemOwner: extractLabel(app.systemOwner),
functionalApplicationManagement: app.functionalApplicationManagement || null,
technicalApplicationManagement: extractLabel(app.technicalApplicationManagement),
technicalApplicationManagementPrimary: extractDisplayValue(app.technicalApplicationManagementPrimary),
technicalApplicationManagementSecondary: extractDisplayValue(app.technicalApplicationManagementSecondary),
// Technical info
medischeTechniek: app.medischeTechniek || false,
technischeArchitectuur: app.technischeArchitectuurTA || null,
supplierProduct: extractLabel(app.supplierProduct),
// Classification
applicationFunctions,
businessImportance: businessImportance?.name || null,
businessImpactAnalyse,
hostingType,
// Application Management
governanceModel,
applicationType,
applicationSubteam,
applicationTeam,
dynamicsFactor,
complexityFactor,
numberOfUsers,
applicationManagementHosting,
applicationManagementTAM,
platform,
// Override
overrideFTE: app.applicationManagementOverrideFTE ?? null,
requiredEffortApplicationManagement: null,
dataCompletenessPercentage: Math.round(completenessPercentage * 10) / 10, // Round to 1 decimal
};
}
@@ -457,6 +497,7 @@ function toApplicationListItem(app: ApplicationComponent): ApplicationListItem {
id: app.id,
key: app.objectKey,
name: app.label,
searchReference: app.searchReference || null,
status: app.status as ApplicationStatus | null,
applicationFunctions,
governanceModel,
@@ -1209,7 +1250,7 @@ export const dataService = {
// Get complexity factor value
if (app.applicationManagementComplexityFactor && typeof app.applicationManagementComplexityFactor === 'object') {
const factorObj = complexityFactorCache?.get(app.applicationManagementComplexityFactor.objectId);
if (factorObj?.factor !== undefined) {
if (factorObj?.factor !== undefined && factorObj.factor !== null) {
metrics.complexityValues.push(factorObj.factor);
}
}
@@ -1217,7 +1258,7 @@ export const dataService = {
// Get dynamics factor value
if (app.applicationManagementDynamicsFactor && typeof app.applicationManagementDynamicsFactor === 'object') {
const factorObj = dynamicsFactorCache?.get(app.applicationManagementDynamicsFactor.objectId);
if (factorObj?.factor !== undefined) {
if (factorObj?.factor !== undefined && factorObj.factor !== null) {
metrics.dynamicsValues.push(factorObj.factor);
}
}