Initial commit: ZiRA Classification Tool for Zuyderland CMDB
This commit is contained in:
203
backend/src/routes/referenceData.ts
Normal file
203
backend/src/routes/referenceData.ts
Normal file
@@ -0,0 +1,203 @@
|
||||
import { Router, Request, Response } from 'express';
|
||||
import { dataService } from '../services/dataService.js';
|
||||
import { logger } from '../services/logger.js';
|
||||
|
||||
const router = Router();
|
||||
|
||||
// Get all reference data
|
||||
router.get('/', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const [
|
||||
dynamicsFactors,
|
||||
complexityFactors,
|
||||
numberOfUsers,
|
||||
governanceModels,
|
||||
organisations,
|
||||
hostingTypes,
|
||||
applicationFunctions,
|
||||
applicationClusters,
|
||||
applicationTypes,
|
||||
businessImportance,
|
||||
businessImpactAnalyses,
|
||||
applicationManagementHosting,
|
||||
applicationManagementTAM,
|
||||
] = await Promise.all([
|
||||
dataService.getDynamicsFactors(),
|
||||
dataService.getComplexityFactors(),
|
||||
dataService.getNumberOfUsers(),
|
||||
dataService.getGovernanceModels(),
|
||||
dataService.getOrganisations(),
|
||||
dataService.getHostingTypes(),
|
||||
dataService.getApplicationFunctions(),
|
||||
dataService.getApplicationClusters(),
|
||||
dataService.getApplicationTypes(),
|
||||
dataService.getBusinessImportance(),
|
||||
dataService.getBusinessImpactAnalyses(),
|
||||
dataService.getApplicationManagementHosting(),
|
||||
dataService.getApplicationManagementTAM(),
|
||||
]);
|
||||
|
||||
res.json({
|
||||
dynamicsFactors,
|
||||
complexityFactors,
|
||||
numberOfUsers,
|
||||
governanceModels,
|
||||
organisations,
|
||||
hostingTypes,
|
||||
applicationFunctions,
|
||||
applicationClusters,
|
||||
applicationTypes,
|
||||
businessImportance,
|
||||
businessImpactAnalyses,
|
||||
applicationManagementHosting,
|
||||
applicationManagementTAM,
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error('Failed to get reference data', error);
|
||||
res.status(500).json({ error: 'Failed to get reference data' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get dynamics factors
|
||||
router.get('/dynamics-factors', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const factors = await dataService.getDynamicsFactors();
|
||||
res.json(factors);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get dynamics factors', error);
|
||||
res.status(500).json({ error: 'Failed to get dynamics factors' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get complexity factors
|
||||
router.get('/complexity-factors', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const factors = await dataService.getComplexityFactors();
|
||||
res.json(factors);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get complexity factors', error);
|
||||
res.status(500).json({ error: 'Failed to get complexity factors' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get number of users options
|
||||
router.get('/number-of-users', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const options = await dataService.getNumberOfUsers();
|
||||
res.json(options);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get number of users', error);
|
||||
res.status(500).json({ error: 'Failed to get number of users' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get governance models
|
||||
router.get('/governance-models', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const models = await dataService.getGovernanceModels();
|
||||
res.json(models);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get governance models', error);
|
||||
res.status(500).json({ error: 'Failed to get governance models' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get organisations
|
||||
router.get('/organisations', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const orgs = await dataService.getOrganisations();
|
||||
res.json(orgs);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get organisations', error);
|
||||
res.status(500).json({ error: 'Failed to get organisations' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get hosting types
|
||||
router.get('/hosting-types', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const types = await dataService.getHostingTypes();
|
||||
res.json(types);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get hosting types', error);
|
||||
res.status(500).json({ error: 'Failed to get hosting types' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get application functions (from Jira Assets)
|
||||
router.get('/application-functions', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const functions = await dataService.getApplicationFunctions();
|
||||
res.json(functions);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get application functions', error);
|
||||
res.status(500).json({ error: 'Failed to get application functions' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get application clusters (from Jira Assets)
|
||||
router.get('/application-clusters', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const clusters = await dataService.getApplicationClusters();
|
||||
res.json(clusters);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get application clusters', error);
|
||||
res.status(500).json({ error: 'Failed to get application clusters' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get application types (from Jira Assets)
|
||||
router.get('/application-types', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const types = await dataService.getApplicationTypes();
|
||||
res.json(types);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get application types', error);
|
||||
res.status(500).json({ error: 'Failed to get application types' });
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/business-importance', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const importance = await dataService.getBusinessImportance();
|
||||
res.json(importance);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get business importance', error);
|
||||
res.status(500).json({ error: 'Failed to get business importance' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get business impact analyses
|
||||
router.get('/business-impact-analyses', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const analyses = await dataService.getBusinessImpactAnalyses();
|
||||
res.json(analyses);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get business impact analyses', error);
|
||||
res.status(500).json({ error: 'Failed to get business impact analyses' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get application management hosting
|
||||
router.get('/application-management-hosting', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const hosting = await dataService.getApplicationManagementHosting();
|
||||
res.json(hosting);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get application management hosting', error);
|
||||
res.status(500).json({ error: 'Failed to get application management hosting' });
|
||||
}
|
||||
});
|
||||
|
||||
// Get application management TAM
|
||||
router.get('/application-management-tam', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const tam = await dataService.getApplicationManagementTAM();
|
||||
res.json(tam);
|
||||
} catch (error) {
|
||||
logger.error('Failed to get application management TAM', error);
|
||||
res.status(500).json({ error: 'Failed to get application management TAM' });
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user