Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion backend/src/entities/shared-jobs/shared-jobs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,27 @@ export class SharedJobsService {
}
console.info(`Starting AI scan for connection with id "${connection.id}"`);
try {
const existingTableSettings = await this._dbContext.tableSettingsRepository.find({
where: {
connection_id: {
id: connection.id,
},
},
});

Comment on lines +37 to +42
Copy link

Copilot AI Jan 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query structure for finding table settings by connection_id is incorrect. The where clause uses a nested object structure connection_id: { id: connection.id }, but based on TypeORM's usage patterns in this codebase, it should directly use the connection ID. The correct structure should be where: { connection_id: connection.id } instead. This will likely cause the query to return no results, making the filtering logic ineffective.

Suggested change
connection_id: {
id: connection.id,
},
},
});
connection_id: connection.id,
},
});

Copilot uses AI. Check for mistakes.
const existingTableNames = new Set(existingTableSettings.map((setting) => setting.table_name));
const dao = getDataAccessObject(connection);
const tables: Array<TableDS> = await dao.getTablesFromDB();
const tablesToScan = tables.filter((table) => !existingTableNames.has(table.tableName));

if (tablesToScan.length === 0) {
console.info(`No new tables to scan for connection with id "${connection.id}"`);
return;
}

const queue = new PQueue({ concurrency: 4 });
const tablesInformation = await Promise.all(
tables.map((table) =>
tablesToScan.map((table) =>
queue.add(async () => {
const structure = await dao.getTableStructure(table.tableName, null);
const primaryColumns = await dao.getTablePrimaryColumns(table.tableName, null);
Expand Down
Loading