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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export class DashboardWidgetEntity {
@Column({ type: 'varchar' })
widget_type: DashboardWidgetTypeEnum;

@Column({ type: 'varchar', default: null, nullable: true })
chart_type: string | null;

@Column({ default: null, nullable: true })
name: string | null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export class DashboardWidgetController {
masterPassword: masterPwd,
userId,
widget_type: createDto.widget_type,
chart_type: createDto.chart_type,
name: createDto.name,
description: createDto.description,
position_x: createDto.position_x,
Expand Down Expand Up @@ -108,6 +109,7 @@ export class DashboardWidgetController {
masterPassword: masterPwd,
userId,
widget_type: updateDto.widget_type,
chart_type: updateDto.chart_type,
name: updateDto.name,
description: updateDto.description,
position_x: updateDto.position_x,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export class CreateDashboardWidgetDs {
masterPassword: string;
userId: string;
widget_type: DashboardWidgetTypeEnum;
chart_type?: string;
name?: string;
description?: string;
position_x?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export class UpdateDashboardWidgetDs {
masterPassword: string;
userId: string;
widget_type?: DashboardWidgetTypeEnum;
chart_type?: string;
name?: string;
description?: string;
position_x?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export class CreateDashboardWidgetDto {
@IsEnum(DashboardWidgetTypeEnum)
widget_type: DashboardWidgetTypeEnum;

@ApiPropertyOptional({ description: 'Chart type for chart widgets' })
@IsOptional()
@IsString()
chart_type?: string;

@ApiPropertyOptional({ description: 'Widget name' })
@IsOptional()
@IsString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export class FoundDashboardWidgetDto {
@ApiProperty({ description: 'Widget type', enum: DashboardWidgetTypeEnum })
widget_type: DashboardWidgetTypeEnum;

@ApiPropertyOptional({ description: 'Chart type for chart widgets' })
chart_type: string | null;

@ApiPropertyOptional({ description: 'Widget name' })
name: string | null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export class UpdateDashboardWidgetDto {
@IsEnum(DashboardWidgetTypeEnum)
widget_type?: DashboardWidgetTypeEnum;

@ApiPropertyOptional({ description: 'Chart type for chart widgets' })
@IsOptional()
@IsString()
chart_type?: string;

@ApiPropertyOptional({ description: 'Widget name' })
@IsOptional()
@IsString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class CreateDashboardWidgetUseCase
connectionId,
masterPassword,
widget_type,
chart_type,
name,
description,
position_x,
Expand Down Expand Up @@ -68,6 +69,7 @@ export class CreateDashboardWidgetUseCase

const newWidget = new DashboardWidgetEntity();
newWidget.widget_type = widget_type;
newWidget.chart_type = chart_type || null;
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 new chart_type field lacks test coverage. The existing dashboard widget e2e tests don't include verification of this field in widget creation, update, or retrieval operations. Consider adding test cases that verify chart_type is properly stored, retrieved, and updated, especially for widgets with widget_type 'chart'.

Copilot uses AI. Check for mistakes.
newWidget.name = name || null;
newWidget.description = description || null;
newWidget.position_x = position_x ?? 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class UpdateDashboardWidgetUseCase
connectionId,
masterPassword,
widget_type,
chart_type,
name,
description,
position_x,
Expand Down Expand Up @@ -78,6 +79,9 @@ export class UpdateDashboardWidgetUseCase
if (widget_type !== undefined) {
foundWidget.widget_type = widget_type;
}
if (chart_type !== undefined) {
foundWidget.chart_type = chart_type;
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 chart_type field handling in the update use case is inconsistent with how the entity expects nullable values. When chart_type is provided as an optional string in the DTO, it should be converted to null when empty or undefined (similar to how it's handled in the create use case with chart_type || null). Currently, if an empty string is passed, it will be stored as an empty string instead of null, which is inconsistent with the entity's nullable design and the create operation.

Suggested change
foundWidget.chart_type = chart_type;
foundWidget.chart_type = chart_type || null;

Copilot uses AI. Check for mistakes.
}
if (name !== undefined) {
foundWidget.name = name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export function buildFoundDashboardWidgetDto(widget: DashboardWidgetEntity): Fou
return {
id: widget.id,
widget_type: widget.widget_type,
chart_type: widget.chart_type,
name: widget.name,
description: widget.description,
position_x: widget.position_x,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class AddChartTypeFieldIntoDashboardWidgetEntity1769087579873 implements MigrationInterface {
name = 'AddChartTypeFieldIntoDashboardWidgetEntity1769087579873';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "dashboard_widget" ADD "chart_type" character varying`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "dashboard_widget" DROP COLUMN "chart_type"`);
}
}
Loading