Fix TypeScript compilation errors in backend

- Fix query parameter type issues (string | string[] to string) in controllers
- Add public getDatabaseAdapter() method to SchemaRepository for db access
- Fix SchemaSyncService export and import issues
- Fix referenceObject vs referenceObjectType property name
- Add missing jiraAssetsClient import in normalizedCacheStore
- Fix duplicate properties in object literals
- Add type annotations for implicit any types
- Fix type predicate issues with generics
- Fix method calls (getEnabledObjectTypes, syncAllSchemas)
- Fix type mismatches (ObjectTypeRecord vs expected types)
- Fix Buffer type issue in biaMatchingService
- Export SchemaSyncService class for ServiceFactory
This commit is contained in:
2026-01-21 09:29:05 +01:00
parent c331540369
commit 6bb5907bbd
14 changed files with 110 additions and 65 deletions

View File

@@ -43,7 +43,6 @@ router.post('/discover', async (req: Request, res: Response) => {
if (result.schemasProcessed === 0) {
logger.warn('Schema configuration: Sync returned 0 schemas - this might indicate an API issue');
res.status(400).json({
success: false,
message: 'No schemas found. Please check: 1) JIRA_SERVICE_ACCOUNT_TOKEN is configured correctly, 2) Jira Assets API is accessible, 3) API endpoint /rest/assets/1.0/objectschema/list is available',
...result,
});
@@ -51,7 +50,6 @@ router.post('/discover', async (req: Request, res: Response) => {
}
res.json({
success: result.success,
message: 'Schema synchronization completed successfully',
schemasDiscovered: result.schemasProcessed,
objectTypesDiscovered: result.objectTypesProcessed,
@@ -88,7 +86,11 @@ router.get('/object-types', async (req: Request, res: Response) => {
*/
router.patch('/object-types/:id/enabled', async (req: Request, res: Response) => {
try {
const id = req.params.id;
const id = Array.isArray(req.params.id) ? req.params.id[0] : req.params.id;
if (!id) {
res.status(400).json({ error: 'id parameter required' });
return;
}
const { enabled } = req.body;
if (typeof enabled !== 'boolean') {
@@ -187,7 +189,12 @@ router.patch('/schemas/:schemaId/search-enabled', async (req: Request, res: Resp
return;
}
await schemaConfigurationService.setSchemaSearchEnabled(schemaId, searchEnabled);
const schemaIdStr = Array.isArray(schemaId) ? schemaId[0] : schemaId;
if (!schemaIdStr) {
res.status(400).json({ error: 'schemaId parameter required' });
return;
}
await schemaConfigurationService.setSchemaSearchEnabled(schemaIdStr, searchEnabled);
res.json({
status: 'success',