Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions backend/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ import { UserActionModule } from './entities/user-actions/user-action.module.js'
import { UserSecretModule } from './entities/user-secret/user-secret.module.js';
import { SignInAuditModule } from './entities/user-sign-in-audit/sign-in-audit.module.js';
import { DashboardModule } from './entities/visualizations/dashboard/dashboards.module.js';
import { DashboardWidgetModule } from './entities/visualizations/dashboard-widget/dashboard-widget.module.js';
import { SavedDbQueryModule } from './entities/visualizations/saved-db-query/saved-db-query.module.js';
import { PanelPositionModule } from './entities/visualizations/panel-position/panel-position.module.js';
import { PanelModule } from './entities/visualizations/panel/panel.module.js';
import { TableWidgetModule } from './entities/widget/table-widget.module.js';
import { SaaSGatewayModule } from './microservices/gateways/saas-gateway.ts/saas-gateway.module.js';
import { SaasModule } from './microservices/saas-microservice/saas.module.js';
Expand Down Expand Up @@ -95,9 +95,9 @@ import { GetHelloUseCase } from './use-cases-app/get-hello.use.case.js';
SignInAuditModule,
PersonalTableSettingsModule,
S3WidgetModule,
SavedDbQueryModule,
PanelModule,
DashboardModule,
DashboardWidgetModule,
PanelPositionModule,
SelfHostedOperationsModule.register(),
],
controllers: [AppController],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ import { ISignInAuditRepository } from '../../entities/user-sign-in-audit/reposi
import { SignInAuditEntity } from '../../entities/user-sign-in-audit/sign-in-audit.entity.js';
import { DashboardEntity } from '../../entities/visualizations/dashboard/dashboard.entity.js';
import { IDashboardRepository } from '../../entities/visualizations/dashboard/repository/dashboard.repository.interface.js';
import { DashboardWidgetEntity } from '../../entities/visualizations/dashboard-widget/dashboard-widget.entity.js';
import { IDashboardWidgetRepository } from '../../entities/visualizations/dashboard-widget/repository/dashboard-widget.repository.interface.js';
import { ISavedDbQueryRepository } from '../../entities/visualizations/saved-db-query/repository/saved-db-query.repository.interface.js';
import { SavedDbQueryEntity } from '../../entities/visualizations/saved-db-query/saved-db-query.entity.js';
import { PanelPositionEntity } from '../../entities/visualizations/panel-position/panel-position.entity.js';
import { IPanelPositionRepository } from '../../entities/visualizations/panel-position/repository/panel-position.repository.interface.js';
import { IPanelRepository } from '../../entities/visualizations/panel/repository/saved-db-query.repository.interface.js';
import { PanelEntity } from '../../entities/visualizations/panel/panel.entity.js';
import { ITableWidgetsRepository } from '../../entities/widget/repository/table-widgets-repository.interface.js';
import { TableWidgetEntity } from '../../entities/widget/table-widget.entity.js';
import { IDatabaseContext } from '../database-context.interface.js';
Expand Down Expand Up @@ -105,9 +105,9 @@ export interface IGlobalDatabaseContext extends IDatabaseContext {
secretAccessLogRepository: Repository<SecretAccessLogEntity> & ISecretAccessLogRepository;
signInAuditRepository: Repository<SignInAuditEntity> & ISignInAuditRepository;
personalTableSettingsRepository: Repository<PersonalTableSettingsEntity> & IPersonalTableSettingsRepository;
savedDbQueryRepository: Repository<SavedDbQueryEntity> & ISavedDbQueryRepository;
panelRepository: Repository<PanelEntity> & IPanelRepository;
dashboardRepository: Repository<DashboardEntity> & IDashboardRepository;
dashboardWidgetRepository: Repository<DashboardWidgetEntity> & IDashboardWidgetRepository;
panelPositionRepository: Repository<PanelPositionEntity> & IPanelPositionRepository;
userAiChatRepository: Repository<UserAiChatEntity> & IUserAiChatRepository;
aiChatMessageRepository: Repository<AiChatMessageEntity> & IAiChatMessageRepository;
}
34 changes: 16 additions & 18 deletions backend/src/common/application/global-database-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ import { SignInAuditEntity } from '../../entities/user-sign-in-audit/sign-in-aud
import { DashboardEntity } from '../../entities/visualizations/dashboard/dashboard.entity.js';
import { IDashboardRepository } from '../../entities/visualizations/dashboard/repository/dashboard.repository.interface.js';
import { dashboardCustomRepositoryExtension } from '../../entities/visualizations/dashboard/repository/dashboard-custom-repository-extension.js';
import { DashboardWidgetEntity } from '../../entities/visualizations/dashboard-widget/dashboard-widget.entity.js';
import { IDashboardWidgetRepository } from '../../entities/visualizations/dashboard-widget/repository/dashboard-widget.repository.interface.js';
import { dashboardWidgetCustomRepositoryExtension } from '../../entities/visualizations/dashboard-widget/repository/dashboard-widget-custom-repository-extension.js';
import { ISavedDbQueryRepository } from '../../entities/visualizations/saved-db-query/repository/saved-db-query.repository.interface.js';
import { savedDbQueryCustomRepositoryExtension } from '../../entities/visualizations/saved-db-query/repository/saved-db-query-custom-repository-extension.js';
import { SavedDbQueryEntity } from '../../entities/visualizations/saved-db-query/saved-db-query.entity.js';
import { PanelPositionEntity } from '../../entities/visualizations/panel-position/panel-position.entity.js';
import { IPanelPositionRepository } from '../../entities/visualizations/panel-position/repository/panel-position.repository.interface.js';
import { panelPositionCustomRepositoryExtension } from '../../entities/visualizations/panel-position/repository/panel-position-custom-repository-extension.js';
import { IPanelRepository } from '../../entities/visualizations/panel/repository/saved-db-query.repository.interface.js';
import { panelCustomRepositoryExtension } from '../../entities/visualizations/panel/repository/saved-db-query-custom-repository-extension.js';
import { PanelEntity } from '../../entities/visualizations/panel/panel.entity.js';
import { tableWidgetsCustomRepositoryExtension } from '../../entities/widget/repository/table-widgets-custom-repsitory-extension.js';
import { ITableWidgetsRepository } from '../../entities/widget/repository/table-widgets-repository.interface.js';
import { TableWidgetEntity } from '../../entities/widget/table-widget.entity.js';
Expand Down Expand Up @@ -159,9 +159,9 @@ export class GlobalDatabaseContext implements IGlobalDatabaseContext {
private _secretAccessLogRepository: Repository<SecretAccessLogEntity> & ISecretAccessLogRepository;
private _signInAuditRepository: Repository<SignInAuditEntity> & ISignInAuditRepository;
private _personalTableSettingsRepository: Repository<PersonalTableSettingsEntity> & IPersonalTableSettingsRepository;
private _savedDbQueryRepository: Repository<SavedDbQueryEntity> & ISavedDbQueryRepository;
private _panelRepository: Repository<PanelEntity> & IPanelRepository;
private _dashboardRepository: Repository<DashboardEntity> & IDashboardRepository;
private _dashboardWidgetRepository: Repository<DashboardWidgetEntity> & IDashboardWidgetRepository;
private _panelPositionRepository: Repository<PanelPositionEntity> & IPanelPositionRepository;
private _userAiChatRepository: Repository<UserAiChatEntity> & IUserAiChatRepository;
private _aiChatMessageRepository: Repository<AiChatMessageEntity> & IAiChatMessageRepository;

Expand Down Expand Up @@ -264,15 +264,13 @@ export class GlobalDatabaseContext implements IGlobalDatabaseContext {
this._personalTableSettingsRepository = this.appDataSource
.getRepository(PersonalTableSettingsEntity)
.extend(personalTableSettingsCustomRepositoryExtension);
this._savedDbQueryRepository = this.appDataSource
.getRepository(SavedDbQueryEntity)
.extend(savedDbQueryCustomRepositoryExtension);
this._panelRepository = this.appDataSource.getRepository(PanelEntity).extend(panelCustomRepositoryExtension);
this._dashboardRepository = this.appDataSource
.getRepository(DashboardEntity)
.extend(dashboardCustomRepositoryExtension);
this._dashboardWidgetRepository = this.appDataSource
.getRepository(DashboardWidgetEntity)
.extend(dashboardWidgetCustomRepositoryExtension);
this._panelPositionRepository = this.appDataSource
.getRepository(PanelPositionEntity)
.extend(panelPositionCustomRepositoryExtension);
this._userAiChatRepository = this.appDataSource
.getRepository(UserAiChatEntity)
.extend(userAiChatRepositoryExtension);
Expand Down Expand Up @@ -431,16 +429,16 @@ export class GlobalDatabaseContext implements IGlobalDatabaseContext {
return this._personalTableSettingsRepository;
}

public get savedDbQueryRepository(): Repository<SavedDbQueryEntity> & ISavedDbQueryRepository {
return this._savedDbQueryRepository;
public get panelRepository(): Repository<PanelEntity> & IPanelRepository {
return this._panelRepository;
}

public get dashboardRepository(): Repository<DashboardEntity> & IDashboardRepository {
return this._dashboardRepository;
}

public get dashboardWidgetRepository(): Repository<DashboardWidgetEntity> & IDashboardWidgetRepository {
return this._dashboardWidgetRepository;
public get panelPositionRepository(): Repository<PanelPositionEntity> & IPanelPositionRepository {
return this._panelPositionRepository;
}

public get userAiChatRepository(): Repository<UserAiChatEntity> & IUserAiChatRepository {
Expand Down
1 change: 1 addition & 0 deletions backend/src/common/data-injection.tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export enum UseCaseType {
CREATE_DASHBOARD_WIDGET = 'CREATE_DASHBOARD_WIDGET',
UPDATE_DASHBOARD_WIDGET = 'UPDATE_DASHBOARD_WIDGET',
DELETE_DASHBOARD_WIDGET = 'DELETE_DASHBOARD_WIDGET',
GENERATE_WIDGET_WITH_AI = 'GENERATE_WIDGET_WITH_AI',

IS_CONFIGURED = 'IS_CONFIGURED',
CREATE_INITIAL_USER = 'CREATE_INITIAL_USER',
Expand Down
8 changes: 4 additions & 4 deletions backend/src/entities/connection/connection.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { TableSettingsEntity } from '../table-settings/common-table-settings/tab
import { PersonalTableSettingsEntity } from '../table-settings/personal-table-settings/personal-table-settings.entity.js';
import { UserEntity } from '../user/user.entity.js';
import { DashboardEntity } from '../visualizations/dashboard/dashboard.entity.js';
import { SavedDbQueryEntity } from '../visualizations/saved-db-query/saved-db-query.entity.js';
import { PanelEntity } from '../visualizations/panel/panel.entity.js';

@Entity('connection')
export class ConnectionEntity {
Expand Down Expand Up @@ -284,10 +284,10 @@ export class ConnectionEntity {
table_filters: Relation<TableFiltersEntity>[];

@OneToMany(
() => SavedDbQueryEntity,
(saved_db_query) => saved_db_query.connection,
() => PanelEntity,
(panel) => panel.connection,
)
saved_db_queries: Relation<SavedDbQueryEntity>[];
panels: Relation<PanelEntity>[];

@OneToMany(
() => DashboardEntity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,20 @@ export class FindTableCategoriesWithTablesUseCase
const foundTableCategories =
await this._dbContext.tableCategoriesRepository.findTableCategoriesForConnection(connectionId);

const sortedTables = tablesRO.sort((tableRO1, tableRO2) => {
const name1 = tableRO1.display_name || tableRO1.table;
const name2 = tableRO2.display_name || tableRO2.table;
return name1.localeCompare(name2);
});
// const sortedTables = tablesRO.sort((tableRO1, tableRO2) => {
// const name1 = tableRO1.display_name || tableRO1.table;
// const name2 = tableRO2.display_name || tableRO2.table;
// return name1.localeCompare(name2);
// });

Comment on lines +93 to 98

Copilot AI Feb 19, 2026

Copy link

Choose a reason for hiding this comment

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

The commented-out table sorting logic should either be removed or uncommented with an explanation. Leaving commented code without context reduces code maintainability and clarity. If this sorting was intentionally disabled, a comment explaining why would be helpful.

Suggested change
// const sortedTables = tablesRO.sort((tableRO1, tableRO2) => {
// const name1 = tableRO1.display_name || tableRO1.table;
// const name2 = tableRO2.display_name || tableRO2.table;
// return name1.localeCompare(name2);
// });

Copilot uses AI. Check for mistakes.
const allTableCategory: FoundTableCategoriesWithTablesRo = {
category_id: null,
category_color: null,
category_name: 'All tables',
tables: sortedTables,
tables: tablesRO,
};
const foundTableCategoriesRO = foundTableCategories.map((category) => {
const tablesInCategory = sortedTables.filter((tableRO) => {
const tablesInCategory = tablesRO.filter((tableRO) => {
return category.tables.includes(tableRO.table);
});
return {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn, Relation } from 'typeorm';
import { ConnectionEntity } from '../../connection/connection.entity.js';
import { DashboardWidgetEntity } from '../dashboard-widget/dashboard-widget.entity.js';
import { PanelPositionEntity } from '../panel-position/panel-position.entity.js';

@Entity('dashboard')
export class DashboardEntity {
Expand All @@ -27,8 +27,8 @@ export class DashboardEntity {
connection: Relation<ConnectionEntity>;

@OneToMany(
() => DashboardWidgetEntity,
() => PanelPositionEntity,
(widget) => widget.dashboard,
)
widgets: Relation<DashboardWidgetEntity>[];
widgets: Relation<PanelPositionEntity>[];
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { FoundDashboardWidgetDto } from '../../dashboard-widget/dto/found-dashboard-widget.dto.js';
import { FoundPanelPositionDto } from '../../panel-position/dto/found-panel-position.dto.js';

export class FoundDashboardDto {
@ApiProperty({ description: 'Dashboard ID' })
Expand All @@ -20,6 +20,6 @@ export class FoundDashboardDto {
@ApiProperty({ description: 'Last update timestamp' })
updated_at: Date;

@ApiPropertyOptional({ description: 'Dashboard widgets', type: FoundDashboardWidgetDto, isArray: true })
widgets?: FoundDashboardWidgetDto[];
@ApiPropertyOptional({ description: 'Dashboard widgets', type: FoundPanelPositionDto, isArray: true })
widgets?: FoundPanelPositionDto[];
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { buildFoundDashboardWidgetDto } from '../../dashboard-widget/utils/build-found-dashboard-widget-dto.util.js';
import { buildFoundPanelPositionDto } from '../../panel-position/utils/build-found-dashboard-widget-dto.util.js';
import { DashboardEntity } from '../dashboard.entity.js';
import { FoundDashboardDto } from '../dto/found-dashboard.dto.js';

Expand All @@ -10,6 +10,6 @@ export function buildFoundDashboardDto(dashboard: DashboardEntity): FoundDashboa
connection_id: dashboard.connection_id,
created_at: dashboard.created_at,
updated_at: dashboard.updated_at,
widgets: dashboard.widgets?.map(buildFoundDashboardWidgetDto),
widgets: dashboard.widgets?.map(buildFoundPanelPositionDto),
};
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export class CreateDashboardWidgetDs {
export class CreatePanelPositionDs {
dashboardId: string;
connectionId: string;
masterPassword: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export class DeleteDashboardWidgetDs {
export class DeletePanelPositionDs {
widgetId: string;
dashboardId: string;
connectionId: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export class GeneratePanelPositionWithAiDs {
dashboardId: string;
connectionId: string;
masterPassword: string;
userId: string;
chart_description: string;
table_name: string;
name?: string;
position_x?: number;
position_y?: number;
width?: number;
height?: number;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export class UpdateDashboardWidgetDs {
export class UpdatePanelPositionDs {
widgetId: string;
dashboardId: string;
connectionId: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApiPropertyOptional } from '@nestjs/swagger';
import { IsInt, IsOptional, IsUUID, Max, Min } from 'class-validator';

export class CreateDashboardWidgetDto {
export class CreatePanelPositionDto {
@ApiPropertyOptional({ description: 'Associated saved query ID' })
@IsOptional()
@IsUUID()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class FoundDashboardWidgetDto {
export class FoundPanelPositionDto {
@ApiProperty({ description: 'Widget ID' })
id: string;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional, IsString, MaxLength } from 'class-validator';

export class GeneratePanelPositionWithAiDto {
@ApiProperty({
type: String,
description: 'Natural language description of the chart you want to create',
example: 'Show monthly sales by product category as a bar chart',
})
@IsNotEmpty()
@IsString()
@MaxLength(2000)
chart_description: string;

@ApiPropertyOptional({
type: String,
description: 'Optional name for the saved query. If not provided, AI will generate one.',
})
@IsOptional()
@IsString()
@MaxLength(255)
name?: string;
}
Loading
Loading