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:
@@ -6,6 +6,7 @@ import { logger } from '../services/logger.js';
|
||||
import { calculateRequiredEffortApplicationManagementWithBreakdown } from '../services/effortCalculation.js';
|
||||
import { findBIAMatch, loadBIAData, clearBIACache, calculateSimilarity } from '../services/biaMatchingService.js';
|
||||
import { calculateApplicationCompleteness } from '../services/dataCompletenessConfig.js';
|
||||
import { getQueryString } from '../utils/queryHelpers.js';
|
||||
import type { SearchFilters, ReferenceValue, ClassificationResult, ApplicationDetails, ApplicationStatus } from '../types/index.js';
|
||||
import type { Server, Flows, Certificate, Domain, AzureSubscription, CMDBObjectTypeName } from '../generated/jira-types.js';
|
||||
|
||||
@@ -31,7 +32,7 @@ router.post('/search', async (req: Request, res: Response) => {
|
||||
// Get team dashboard data
|
||||
router.get('/team-dashboard', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const excludedStatusesParam = req.query.excludedStatuses as string | undefined;
|
||||
const excludedStatusesParam = getQueryString(req, 'excludedStatuses');
|
||||
let excludedStatuses: ApplicationStatus[] = [];
|
||||
|
||||
if (excludedStatusesParam && excludedStatusesParam.trim().length > 0) {
|
||||
@@ -56,7 +57,7 @@ router.get('/team-dashboard', async (req: Request, res: Response) => {
|
||||
// Get team portfolio health metrics
|
||||
router.get('/team-portfolio-health', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const excludedStatusesParam = req.query.excludedStatuses as string | undefined;
|
||||
const excludedStatusesParam = getQueryString(req, 'excludedStatuses');
|
||||
let excludedStatuses: ApplicationStatus[] = [];
|
||||
|
||||
if (excludedStatusesParam && excludedStatusesParam.trim().length > 0) {
|
||||
@@ -95,7 +96,7 @@ router.get('/business-importance-comparison', async (req: Request, res: Response
|
||||
// Test BIA data loading (for debugging)
|
||||
router.get('/bia-test', async (req: Request, res: Response) => {
|
||||
try {
|
||||
if (req.query.clear === 'true') {
|
||||
if (getQueryString(req, 'clear') === 'true') {
|
||||
clearBIACache();
|
||||
}
|
||||
const biaData = loadBIAData();
|
||||
@@ -133,7 +134,7 @@ router.get('/bia-debug', async (req: Request, res: Response) => {
|
||||
|
||||
// Test each sample app
|
||||
for (const app of [...sampleApps, ...testApps]) {
|
||||
const matchResult = findBIAMatch(app.name, app.searchReference);
|
||||
const matchResult = findBIAMatch(app.name, app.searchReference ?? null);
|
||||
|
||||
// Find all potential matches in Excel data for detailed analysis
|
||||
const normalizedAppName = app.name.toLowerCase().trim();
|
||||
@@ -246,7 +247,7 @@ router.get('/bia-comparison', async (req: Request, res: Response) => {
|
||||
|
||||
for (const app of applications) {
|
||||
// Find BIA match in Excel
|
||||
const matchResult = findBIAMatch(app.name, app.searchReference);
|
||||
const matchResult = findBIAMatch(app.name, app.searchReference ?? null);
|
||||
|
||||
// Log first few matches for debugging
|
||||
if (comparisonItems.length < 5) {
|
||||
@@ -323,7 +324,7 @@ router.get('/bia-comparison', async (req: Request, res: Response) => {
|
||||
router.get('/:id', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const { id } = req.params;
|
||||
const mode = req.query.mode as string | undefined;
|
||||
const mode = getQueryString(req, 'mode');
|
||||
|
||||
// Don't treat special routes as application IDs
|
||||
if (id === 'team-dashboard' || id === 'team-portfolio-health' || id === 'business-importance-comparison' || id === 'bia-comparison' || id === 'bia-test' || id === 'calculate-effort' || id === 'search') {
|
||||
@@ -617,8 +618,9 @@ router.get('/:id/related/:objectType', async (req: Request, res: Response) => {
|
||||
}
|
||||
|
||||
// Get requested attributes from query string
|
||||
const requestedAttrs = req.query.attributes
|
||||
? String(req.query.attributes).split(',').map(a => a.trim())
|
||||
const attributesParam = getQueryString(req, 'attributes');
|
||||
const requestedAttrs = attributesParam
|
||||
? attributesParam.split(',').map(a => a.trim())
|
||||
: [];
|
||||
|
||||
// Format response - must match RelatedObjectsResponse type expected by frontend
|
||||
|
||||
Reference in New Issue
Block a user