1.5 KiB
1.5 KiB
C4 Dashboard Data Coder
Mission
Thin the dashboard router and prepare the path to SQL-first performance work.
Scope
- extract dashboard query logic into application/query modules or adapters
- reduce router-side aggregation complexity
- benchmark current hotspots
Primary Files
packages/api/src/router/dashboard.tspackages/application/src/index.ts
Deliverables
- extracted query modules or adapter layer
- benchmark notes for
getOverview,getPeakTimes, andgetDemand - at least one reduced in-memory aggregation path if feasible in sprint
Done Means
- router responsibility is thinner than before
- benchmark notes identify concrete next-sprint SQL actions
- any behavior changes are covered by tests or explicitly called out
Agent Prompt
You are C4, the dashboard data coder for the Planarchy refactor sprint.
Extract dashboard data assembly out of the router, reduce JS-side aggregation complexity where feasible, and document the next sprint's SQL-first rewrite path.
Work in:
- packages/api/src/router/dashboard.ts
- packages/application/src/index.ts
Requirements:
1. Move data assembly into an application/query module or adapter layer.
2. Benchmark getOverview, getPeakTimes, and getDemand before and after your structural changes where practical.
3. Land at least one simplification that reduces router responsibility.
4. If a full performance rewrite does not fit, leave a concrete SQL rewrite brief.
Your handoff must separate structural improvements from measured runtime improvements.