Files
task-stream/libs/web/tracker/application/src/lib/facades/insights.facade.ts
Josep Piguillem 0d158a2ed7 feat: dashboard forecasts releases, tells what changed and weighs the load
The insights reading grows (GraphQL insights(since:), REST ?since=, MCP):
- planned releases with a likely (p50) and safe (p85) finish date from a
  Monte Carlo over the last six weeks of finished work, one after another,
  and a verdict against their target;
- with `since` (the viewer's last visit, kept in the browser): tickets
  created, finished and sent back from QA, and their mentions;
- each person's open points against what they closed per sprint lately;
- open tickets without estimate, area or assignee, or untouched for 90
  days, each count opening the list filtered (new noEstimate, noArea and
  updatedBefore filters).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 12:50:24 +02:00

30 lines
1.1 KiB
TypeScript

import { inject, Injectable, Provider } from '@angular/core';
import { injectDispatch } from '@ngrx/signals/events';
import { insightsPageEvents } from '../events/insights.events';
import { InsightsStore } from '../stores/insights.store';
/** "Seguimiento": sprint under way, risks, aging and bottlenecks. */
@Injectable()
export class InsightsFacade {
private readonly store = inject(InsightsStore);
private readonly dispatch = injectDispatch(insightsPageEvents);
readonly insights = this.store.insights;
/** False until the first load: show skeletons, not empty states. */
readonly loaded = this.store.loaded;
readonly error = this.store.error;
/**
* Loads the project's reading and keeps it up to date; with `since` (my
* last visit), it also tells what changed after it.
*/
open(projectId: string, since: string | null = null): void {
this.dispatch.opened({ projectId, since });
}
}
/** Store + facade of the dashboard, for its route component. */
export function provideInsightsFacade(): Provider[] {
return [InsightsStore, InsightsFacade];
}