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
@@ -1,6 +1,7 @@
import { DashboardEntity } from '../dashboard.entity.js';
import { IDashboardRepository } from './dashboard.repository.interface.js';

export const dashboardCustomRepositoryExtension = {
export const dashboardCustomRepositoryExtension: IDashboardRepository = {
async findDashboardById(dashboardId: string): Promise<DashboardEntity | null> {
return await this.findOne({ where: { id: dashboardId } });
},
Expand All @@ -25,6 +26,14 @@ export const dashboardCustomRepositoryExtension = {
});
},

async findAllDashboardsWithWidgetsByConnectionId(connectionId: string): Promise<DashboardEntity[]> {
const qb = this.createQueryBuilder('dashboard')
.leftJoinAndSelect('dashboard.widgets', 'widgets')
.where('dashboard.connection_id = :connectionId', { connectionId })
.orderBy('dashboard.created_at', 'DESC');
return await qb.getMany();
},

async saveDashboard(dashboard: DashboardEntity): Promise<DashboardEntity> {
return await this.save(dashboard);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export interface IDashboardRepository {
findAllDashboardsByConnectionId(connectionId: string): Promise<DashboardEntity[]>;
saveDashboard(dashboard: DashboardEntity): Promise<DashboardEntity>;
removeDashboard(dashboard: DashboardEntity): Promise<DashboardEntity>;
findAllDashboardsWithWidgetsByConnectionId(connectionId: string): Promise<DashboardEntity[]>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export class FindAllDashboardsUseCase
throw new NotFoundException(Messages.CONNECTION_NOT_FOUND);
}

const dashboards = await this._dbContext.dashboardRepository.findAllDashboardsByConnectionId(connectionId);
const dashboards =
await this._dbContext.dashboardRepository.findAllDashboardsWithWidgetsByConnectionId(connectionId);
Comment on lines +35 to +36

Copilot AI Feb 6, 2026

Copy link

Choose a reason for hiding this comment

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

The method call has changed from findAllDashboardsByConnectionId to findAllDashboardsWithWidgetsByConnectionId, which now includes widgets in the response. However, the existing test for the GET /dashboards/:connectionId endpoint (lines 63-87 in dashboard-e2e.test.ts) only verifies that an array is returned but doesn't verify the widgets field is present or correctly populated. Consider adding test coverage to verify that dashboards returned by this endpoint now include their associated widgets.

Copilot uses AI. Check for mistakes.

return dashboards.map(buildFoundDashboardDto);
}
Expand Down
1 change: 0 additions & 1 deletion backend/test/ava-tests/saas-tests/dashboard-e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ test.serial(`${currentTest} should create a new dashboard`, async (t) => {
.set('Accept', 'application/json');

const createDashboardRO = JSON.parse(createDashboard.text);
console.log('🚀 ~ createDashboardRO:', createDashboardRO);
t.is(createDashboard.status, 201);
t.is(createDashboardRO.name, newDashboard.name);
t.is(createDashboardRO.description, newDashboard.description);
Expand Down
Loading