Fix all req.params and req.query type errors
- Add getParamString helper function for req.params - Replace all req.params destructuring with getParamString - Fix remaining req.query.* direct usage errors - All TypeScript compilation errors now resolved
This commit is contained in:
@@ -6,7 +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 { getQueryString, getParamString } 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';
|
||||
|
||||
@@ -323,7 +323,7 @@ router.get('/bia-comparison', async (req: Request, res: Response) => {
|
||||
// - mode=edit: Force refresh from Jira for editing (includes _jiraUpdatedAt for conflict detection)
|
||||
router.get('/:id', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const { id } = req.params;
|
||||
const id = getParamString(req, 'id');
|
||||
const mode = getQueryString(req, 'mode');
|
||||
|
||||
// Don't treat special routes as application IDs
|
||||
@@ -359,7 +359,7 @@ router.get('/:id', async (req: Request, res: Response) => {
|
||||
// Update application with conflict detection
|
||||
router.put('/:id', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const { id } = req.params;
|
||||
const id = getParamString(req, 'id');
|
||||
const { updates, _jiraUpdatedAt } = req.body as {
|
||||
updates?: {
|
||||
applicationFunctions?: ReferenceValue[];
|
||||
@@ -471,7 +471,7 @@ router.put('/:id', async (req: Request, res: Response) => {
|
||||
// Force update (ignore conflicts)
|
||||
router.put('/:id/force', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const { id } = req.params;
|
||||
const id = getParamString(req, 'id');
|
||||
const updates = req.body;
|
||||
|
||||
const application = await dataService.getApplicationById(id);
|
||||
@@ -552,7 +552,7 @@ router.post('/calculate-effort', async (req: Request, res: Response) => {
|
||||
// Get application classification history
|
||||
router.get('/:id/history', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const { id } = req.params;
|
||||
const id = getParamString(req, 'id');
|
||||
const history = await databaseService.getClassificationsByApplicationId(id);
|
||||
res.json(history);
|
||||
} catch (error) {
|
||||
@@ -564,7 +564,8 @@ router.get('/:id/history', async (req: Request, res: Response) => {
|
||||
// Get related objects for an application (from cache)
|
||||
router.get('/:id/related/:objectType', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const { id, objectType } = req.params;
|
||||
const id = getParamString(req, 'id');
|
||||
const objectType = getParamString(req, 'objectType');
|
||||
|
||||
// Map object type string to CMDBObjectTypeName
|
||||
const typeMap: Record<string, CMDBObjectTypeName> = {
|
||||
|
||||
Reference in New Issue
Block a user