feat: add findAllDashboardsWithWidgetsByConnectionId method to dashboard repository#1577
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new repository method findAllDashboardsWithWidgetsByConnectionId to enable fetching all dashboards for a connection with their associated widgets eagerly loaded. This improves the API response for the GET /dashboards/:connectionId endpoint by including widget information without additional queries.
Changes:
- Added new
findAllDashboardsWithWidgetsByConnectionIdmethod to dashboard repository interface and implementation - Updated
FindAllDashboardsUseCaseto use the new method instead offindAllDashboardsByConnectionId - Removed debug console.log statement from test file
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| backend/test/ava-tests/saas-tests/dashboard-e2e.test.ts | Cleanup: removed debug console.log statement |
| backend/src/entities/visualizations/dashboard/use-cases/find-all-dashboards.use.case.ts | Updated to call new repository method that includes widgets |
| backend/src/entities/visualizations/dashboard/repository/dashboard.repository.interface.ts | Added new method signature to interface |
| backend/src/entities/visualizations/dashboard/repository/dashboard-custom-repository-extension.ts | Implemented new method with TypeORM query builder to eager load widgets, added proper typing to repository extension |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const dashboards = | ||
| await this._dbContext.dashboardRepository.findAllDashboardsWithWidgetsByConnectionId(connectionId); |
There was a problem hiding this comment.
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.
No description provided.