Skip to content

Dashboard Module

Provides read-only analytics for UI dashboards: totals, category breakdown, recent transactions, wallet balances, and budget allocations.

  • GET /api/v1/dashboard/summary
  • GET /api/v1/dashboard/categories
  • GET /api/v1/dashboard/transactions
  • GET /api/v1/dashboard/wallets
  • GET /api/v1/dashboard/allocations
  • Date filters are parsed from query string and must be valid dates.
  • transactions endpoint validates limit as a positive number.
  • Date range integrity is validated in application layer (ensureValidDateRange).
RouteControllerUse case/serviceRepository chainRoute file trace
GET /dashboard/summaryDashboardController.getSummaryDashboardServicesImpl.getSummaryTransactionRepositoryImplbackend/src/Presentation/Routes/DashboardRoutes.ts
GET /dashboard/categoriesDashboardController.getCategoryBreakdownDashboardServicesImpl.getCategoryBreakdownTransactionRepositoryImpl, CategoryRepositoryImplbackend/src/Presentation/Routes/DashboardRoutes.ts
GET /dashboard/transactionsDashboardController.getRecentTransactionsDashboardServicesImpl.getRecentTransactionsTransactionRepositoryImplbackend/src/Presentation/Routes/DashboardRoutes.ts
GET /dashboard/walletsDashboardController.getWalletBalancesDashboardServicesImpl.getWalletBalancesWalletRepositoryImpl, TransactionRepositoryImplbackend/src/Presentation/Routes/DashboardRoutes.ts
GET /dashboard/allocationsDashboardController.getAllocationsDashboardServicesImpl.getAllocationsBudgetAllocationRepositoryImplbackend/src/Presentation/Routes/DashboardRoutes.ts

Controller: backend/src/Presentation/Controllers/DashboardController.ts.

  • INVALID_PAYLOAD (400) for invalid date or limit query values.
  • USER_NOT_AUTHENTICATED (401).
  • DASHBOARD_* errors (500) when aggregation fails.
  • E2E files:
    • backend/src/tests/e2e/dashboard/dashboard-summary.e2e.test.ts
    • backend/src/tests/e2e/dashboard/dashboard-categories.e2e.test.ts
    • backend/src/tests/e2e/dashboard/dashboard-wallets.e2e.test.ts
Terminal window
curl -X GET "https://budgeti-backend.johandercampos.com/api/v1/dashboard/summary?startDate=2026-02-01&endDate=2026-02-29&walletId=wlt_123" \
-H "Authorization: Bearer <jwt>"
{
"code": "DASHBOARD_SUMMARY_READY",
"message": "Dashboard summary generated successfully",
"data": {
"totalIncome": 2500,
"totalExpenses": 1740.5,
"balance": 759.5
}
}
{
"code": "USER_NOT_AUTHENTICATED",
"message": "User is not authenticated",
"error": "User is not authenticated"
}
// DashboardController.getSummary
const { startDate, endDate } = parseDates(req);
const summary = await dashboardService.getSummary({
userId: req.userId!,
startDate,
endDate,
walletId: req.query.walletId as string | undefined,
categoryId: req.query.categoryId as string | undefined,
limit: 10,
});
return res.status(200).json({
...buildSuccessResponse(SuccessCodes.DASHBOARD_SUMMARY_READY),
data: summary,
});