Service Layer medium complexity backend
0
Dependencies
0
Dependents
13
Entities
0
Integrations

Description

Backend service that aggregates KPI figures from the activity, contact, and expense tables and returns them as a single response scoped to the requesting admin's tenant. It enforces role-based data scoping before querying the repository.

Feature: Dashboard KPIs

dashboard-kpi-service

Sources & reasoning

Lines 325-327 explicitly list "Aktivitetsoversikt og grunnleggende statistikk" (activity overview and basic statistics) as Admin Web Portal MVP scope. Lines 189-197 confirm "organization-level dashboards and KPIs" as a core admin portal capability. Both place this feature in Fase 1 / MVP, normalizing to target_release "MVP".

  • docs/source/likeperson.md · line 325-327
    Admin Web Portal (MVP scope): Brukeradministrasjon (invitere, deaktivere, rolletildeling) Organisasjonsinnstillinger og terminologikonfigurasjon Aktivitetsoversikt og grunnleggende statistikk
  • docs/source/likeperson.md · line 189-197

Responsibilities

  • Resolve the tenant scope from the authenticated admin's role and current context
  • Aggregate active peer mentor count, logged activity count, pending approval count, and reimbursement total
  • Delegate data retrieval to DashboardRepository and transform raw rows into KPI metric objects
  • Enforce that Org Admins only receive their own organization's data

Interfaces

getKpis(adminContext: AdminContext): Promise<KpiSummary>
resolveTenantScope(adminContext: AdminContext): TenantScope