DashboardKpiService
Component Detail
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.
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-327Admin 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
Related Data Entities (13)
Data entities managed by this component
Activity
23 fields
core
Activity Type
15 fields
configuration
Contact
22 fields
core
Event
16 fields
core
Event Registration
13 fields
core
Home Visit Report
21 fields
core
Local Association
13 fields
core
Organization
21 fields
core
Organization Hierarchy
12 fields
configuration
Organization Settings
25 fields
configuration
Referral Tracking
12 fields
core
User
24 fields
core
User Achievement
10 fields
core