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:
@@ -11,6 +11,7 @@
|
||||
|
||||
import { logger } from '../logger.js';
|
||||
import { normalizedCacheStore } from '../normalizedCacheStore.js';
|
||||
import type { DatabaseAdapter } from './interface.js';
|
||||
|
||||
export async function migrateToNormalizedSchema(): Promise<void> {
|
||||
const db = (normalizedCacheStore as any).db;
|
||||
@@ -23,7 +24,7 @@ export async function migrateToNormalizedSchema(): Promise<void> {
|
||||
logger.info('Migration: Starting migration to normalized schema structure...');
|
||||
|
||||
try {
|
||||
await db.transaction(async (txDb) => {
|
||||
await db.transaction(async (txDb: DatabaseAdapter) => {
|
||||
// Step 1: Check if configured_object_types table exists
|
||||
let configuredTableExists = false;
|
||||
try {
|
||||
@@ -172,14 +173,14 @@ export async function migrateToNormalizedSchema(): Promise<void> {
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = 'public' AND table_name = 'object_types'
|
||||
`);
|
||||
hasSchemaId = columns.some(c => c.column_name === 'schema_id');
|
||||
hasEnabled = columns.some(c => c.column_name === 'enabled');
|
||||
hasSchemaId = columns.some((c: { column_name: string }) => c.column_name === 'schema_id');
|
||||
hasEnabled = columns.some((c: { column_name: string }) => c.column_name === 'enabled');
|
||||
} else {
|
||||
const tableInfo = await txDb.query<{ name: string }>(`
|
||||
PRAGMA table_info(object_types)
|
||||
`);
|
||||
hasSchemaId = tableInfo.some(c => c.name === 'schema_id');
|
||||
hasEnabled = tableInfo.some(c => c.name === 'enabled');
|
||||
hasSchemaId = tableInfo.some((c: { name: string }) => c.name === 'schema_id');
|
||||
hasEnabled = tableInfo.some((c: { name: string }) => c.name === 'enabled');
|
||||
}
|
||||
} catch (error) {
|
||||
logger.warn('Migration: Could not check object_types columns', error);
|
||||
|
||||
Reference in New Issue
Block a user