feat(api): add dashboard summary endpoint (#459)
All checks were successful
ci/woodpecker/push/api Pipeline was successful

Create GET /api/dashboard/summary aggregating 10 parallel Prisma
queries: task metrics, active agents, project counts, error rate,
recent activity, active runner jobs with steps, token budget entries.

Guarded by AuthGuard + WorkspaceGuard + PermissionGuard.
Includes DTO classes and unit tests.

Task: MS-P2-001

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-22 18:27:04 -06:00
parent 90bef728e6
commit e38aaa950b
7 changed files with 430 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
/**
* Dashboard Summary DTO
* Defines the response shape for the dashboard summary endpoint.
*/
export class DashboardMetricsDto {
activeAgents!: number;
tasksCompleted!: number;
totalTasks!: number;
tasksInProgress!: number;
activeProjects!: number;
errorRate!: number;
}
export class RecentActivityDto {
id!: string;
action!: string;
entityType!: string;
entityId!: string;
details!: unknown;
userId!: string;
createdAt!: string;
}
export class ActiveJobStepDto {
id!: string;
name!: string;
status!: string;
phase!: string;
}
export class ActiveJobDto {
id!: string;
type!: string;
status!: string;
progressPercent!: number;
createdAt!: string;
updatedAt!: string;
steps!: ActiveJobStepDto[];
}
export class TokenBudgetEntryDto {
model!: string;
used!: number;
limit!: number;
}
export class DashboardSummaryDto {
metrics!: DashboardMetricsDto;
recentActivity!: RecentActivityDto[];
activeJobs!: ActiveJobDto[];
tokenBudget!: TokenBudgetEntryDto[];
}