Files
co-lite/openspec/changes/add-lead-dashboard/tasks.md
T

4.0 KiB
Raw Blame History

Tasks

Design: design.md (technical contract) and docs/superpowers/specs/2026-12-01-lead-dashboard-design.md (product).

Waves:

  • Wave 0 (serial, controller): 1.1 and 1.2 touch hotspots (SQL, seed, package.json).
  • Wave 1 (parallel, 3 implementers): 2.1, 3.1 and 4.1 build against the fixed contracts in design decisions 4 and 5. Scopes do not overlap: each touches one module.
  • Wave 2 (serial, controller): 5.1.

1. Data, module and chart dependency

  • 1.1 SQL sql/01..03 and 99-rollback.sql; mirror 01 and 03 in local/seed/03-colite.sql (02 has nothing to backfill on an empty volume); apply 01, 02 and 03 to the local database.
    • Depends on: none
    • Scope: local/seed/**, openspec/changes/add-lead-dashboard/sql/**
    • Verify: SELECT shows the table, the index, the backfilled rows and the module row.
  • 1.2 Portal: add recharts (same major as babyboo's portal) with npm install, and copy babyboo's app/components/ui/chart.tsx.
    • Depends on: none
    • Scope: solvway-admin-portal/package.json, solvway-admin-portal/package-lock.json, solvway-admin-portal/app/components/ui/chart.tsx
    • Verify: cd solvway-admin-portal && npm run lint && npx tsc --noEmit && npx vitest run

2. services-counter

  • 2.1 Status history writes (decision 1) and the dashboard endpoint (decisions 2 to 4).
    • Tests first:
      • capture saves one history row null → initial status at the capture time, by doneBy;
      • update saves one row when the status changes and none when it stays;
      • the calculator, from in-memory rows: captures, new leads, funnel, won in period (latest WON only), median days (odd, even, none), overdue per salesperson, Unassigned, salesperson with overdue only, interest double-count, event ordering, zero-filled day and month trend, Malaysia day boundary from JVM-zone times;
      • the endpoint rejects from after to with 400 INVALID_PERIOD and passes a null company as all companies.
    • Scope: solvway-services-counter/src/**
    • Verify: mvn -T 1C -q -pl solvway-services-counter verify

3. mobile-api

  • 3.1 GET /api/admin/dashboard/leads (decision 5).
    • Tests first:
      • default period is this Malaysian month to today; DAY bucket up to 62 days, MONTH above;
      • bad date and from after to → 400 INVALID_PERIOD;
      • staff are scoped to their company, a super admin's companyId is passed through, null for all;
      • salesperson names resolved, null for Unassigned and for a missing user;
      • the endpoint is gated by BO_DASHBOARD (aspect test with the annotation).
    • Scope: solvway-mobile-api/src/**
    • Verify: mvn -T 1C -q -pl solvway-mobile-api verify

4. Portal

  • 4.1 Home page dashboard (decision 7).
    • Tests first:
      • without BO_DASHBOARD the welcome shows and the dashboard API is not called;
      • with it: tiles, funnel, chart container, the three tables with Unassigned, whole-percent rates and "–" for null median and zero captures;
      • period presets send the right from/to; a reversed custom range shows the error message;
      • a super admin's picker sends companyId and shows the Company column only for all companies;
      • an event row links to /event-leads/{eventUuid};
      • the hard-coded copy sweep stays green (labels as message keys).
    • Scope: solvway-admin-portal/app/page.tsx, solvway-admin-portal/app/page*.test.tsx, solvway-admin-portal/app/components/dashboard/**, solvway-admin-portal/app/lib/services/adminDashboard*.ts, solvway-admin-portal/app/lib/i18n/defaultMessages.ts
    • Verify: cd solvway-admin-portal && npm run lint && npx tsc --noEmit && npx vitest run

5. Release

  • 5.1 docs/deployment.md lists the SQL; live check against the local stack (seeded INS and CV event leads with status changes), and Playwright at 1280 and 360 px for a granted user, a user without the module, and a super admin switching company.
    • Depends on: 1.1 to 4.1
    • Scope: docs/deployment.md, openspec/changes/add-lead-dashboard/tasks.md
    • Verify: full mvn -T 1C -q verify of the three touched Maven modules and the portal verify.