Skip to content

Commit f95bcfe

Browse files
committed
Merge branch 'main' into backend_langchain
2 parents 7985662 + af50d73 commit f95bcfe

12 files changed

Lines changed: 57 additions & 1 deletion

backend/src/entities/shared-jobs/shared-jobs.service.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,27 @@ export class SharedJobsService {
3232
}
3333
console.info(`Starting AI scan for connection with id "${connection.id}"`);
3434
try {
35+
const existingTableSettings = await this._dbContext.tableSettingsRepository.find({
36+
where: {
37+
connection_id: {
38+
id: connection.id,
39+
},
40+
},
41+
});
42+
43+
const existingTableNames = new Set(existingTableSettings.map((setting) => setting.table_name));
3544
const dao = getDataAccessObject(connection);
3645
const tables: Array<TableDS> = await dao.getTablesFromDB();
46+
const tablesToScan = tables.filter((table) => !existingTableNames.has(table.tableName));
47+
48+
if (tablesToScan.length === 0) {
49+
console.info(`No new tables to scan for connection with id "${connection.id}"`);
50+
return;
51+
}
52+
3753
const queue = new PQueue({ concurrency: 4 });
3854
const tablesInformation = await Promise.all(
39-
tables.map((table) =>
55+
tablesToScan.map((table) =>
4056
queue.add(async () => {
4157
const structure = await dao.getTableStructure(table.tableName, null);
4258
const primaryColumns = await dao.getTablePrimaryColumns(table.tableName, null);

backend/src/entities/visualizations/dashboard-widget/dashboard-widget.entity.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export class DashboardWidgetEntity {
2222
@Column({ type: 'varchar' })
2323
widget_type: DashboardWidgetTypeEnum;
2424

25+
@Column({ type: 'varchar', default: null, nullable: true })
26+
chart_type: string | null;
27+
2528
@Column({ default: null, nullable: true })
2629
name: string | null;
2730

backend/src/entities/visualizations/dashboard-widget/dashboard-widgets.controller.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export class DashboardWidgetController {
6969
masterPassword: masterPwd,
7070
userId,
7171
widget_type: createDto.widget_type,
72+
chart_type: createDto.chart_type,
7273
name: createDto.name,
7374
description: createDto.description,
7475
position_x: createDto.position_x,
@@ -108,6 +109,7 @@ export class DashboardWidgetController {
108109
masterPassword: masterPwd,
109110
userId,
110111
widget_type: updateDto.widget_type,
112+
chart_type: updateDto.chart_type,
111113
name: updateDto.name,
112114
description: updateDto.description,
113115
position_x: updateDto.position_x,

backend/src/entities/visualizations/dashboard-widget/data-structures/create-dashboard-widget.ds.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export class CreateDashboardWidgetDs {
66
masterPassword: string;
77
userId: string;
88
widget_type: DashboardWidgetTypeEnum;
9+
chart_type?: string;
910
name?: string;
1011
description?: string;
1112
position_x?: number;

backend/src/entities/visualizations/dashboard-widget/data-structures/update-dashboard-widget.ds.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export class UpdateDashboardWidgetDs {
77
masterPassword: string;
88
userId: string;
99
widget_type?: DashboardWidgetTypeEnum;
10+
chart_type?: string;
1011
name?: string;
1112
description?: string;
1213
position_x?: number;

backend/src/entities/visualizations/dashboard-widget/dto/create-dashboard-widget.dto.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ export class CreateDashboardWidgetDto {
88
@IsEnum(DashboardWidgetTypeEnum)
99
widget_type: DashboardWidgetTypeEnum;
1010

11+
@ApiPropertyOptional({ description: 'Chart type for chart widgets' })
12+
@IsOptional()
13+
@IsString()
14+
chart_type?: string;
15+
1116
@ApiPropertyOptional({ description: 'Widget name' })
1217
@IsOptional()
1318
@IsString()

backend/src/entities/visualizations/dashboard-widget/dto/found-dashboard-widget.dto.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ export class FoundDashboardWidgetDto {
88
@ApiProperty({ description: 'Widget type', enum: DashboardWidgetTypeEnum })
99
widget_type: DashboardWidgetTypeEnum;
1010

11+
@ApiPropertyOptional({ description: 'Chart type for chart widgets' })
12+
chart_type: string | null;
13+
1114
@ApiPropertyOptional({ description: 'Widget name' })
1215
name: string | null;
1316

backend/src/entities/visualizations/dashboard-widget/dto/update-dashboard-widget.dto.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ export class UpdateDashboardWidgetDto {
88
@IsEnum(DashboardWidgetTypeEnum)
99
widget_type?: DashboardWidgetTypeEnum;
1010

11+
@ApiPropertyOptional({ description: 'Chart type for chart widgets' })
12+
@IsOptional()
13+
@IsString()
14+
chart_type?: string;
15+
1116
@ApiPropertyOptional({ description: 'Widget name' })
1217
@IsOptional()
1318
@IsString()

backend/src/entities/visualizations/dashboard-widget/use-cases/create-dashboard-widget.use.case.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export class CreateDashboardWidgetUseCase
2727
connectionId,
2828
masterPassword,
2929
widget_type,
30+
chart_type,
3031
name,
3132
description,
3233
position_x,
@@ -68,6 +69,7 @@ export class CreateDashboardWidgetUseCase
6869

6970
const newWidget = new DashboardWidgetEntity();
7071
newWidget.widget_type = widget_type;
72+
newWidget.chart_type = chart_type || null;
7173
newWidget.name = name || null;
7274
newWidget.description = description || null;
7375
newWidget.position_x = position_x ?? 0;

backend/src/entities/visualizations/dashboard-widget/use-cases/update-dashboard-widget.use.case.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export class UpdateDashboardWidgetUseCase
2727
connectionId,
2828
masterPassword,
2929
widget_type,
30+
chart_type,
3031
name,
3132
description,
3233
position_x,
@@ -78,6 +79,9 @@ export class UpdateDashboardWidgetUseCase
7879
if (widget_type !== undefined) {
7980
foundWidget.widget_type = widget_type;
8081
}
82+
if (chart_type !== undefined) {
83+
foundWidget.chart_type = chart_type;
84+
}
8185
if (name !== undefined) {
8286
foundWidget.name = name;
8387
}

0 commit comments

Comments
 (0)