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

Description

Aggregates activity, contact, and time-log data across the shared backend and exposes pre-computed team statistics to the Admin Web Portal. Enforces multi-tenant isolation so queries are always scoped to the requesting organization. Coordinates with role-based access control to restrict report access to coordinators and administrators.

Feature: Team Reports

team-report-service

Sources & reasoning

Fase 1 MVP scope for Admin Web Portal explicitly includes 'aktivitetsoversikt og grunnleggende statistikk' (lines 325-328), normalizing to MVP. Team Reports is the concrete implementation of that requirement. Source also clarifies the admin portal is the reporting surface, confirming this belongs in Reporting & Export.

  • Admin Web Portal (MVP scope): Brukeradministrasjon (invitere, deaktivere, rolletildeling) Organisasjonsinnstillinger og terminologikonfigurasjon Aktivitetsoversikt og grunnleggende statistikk
  • Sømløs Bufdir-rapportering - Rapporteringsdata samles inn gjennom aktivitetsregistrering i mobilappen, men selve Bufdir-eksporten er en admin-funksjon

Responsibilities

  • Aggregate registered activities, contact interactions, and logged hours per coordinator group
  • Enforce multi-tenant data isolation so each organization accesses only its own team data
  • Apply role-based access checks to ensure only coordinators and administrators can retrieve reports
  • Accept filter parameters (date range, team scope) and return scoped aggregated results
  • Serve pre-aggregated statistics to avoid exposing raw individual user records

Interfaces

getTeamReport(orgId: string, filters: ReportFilters): Promise<TeamReportResult>
aggregateByCoordinatorGroup(orgId: string, dateRange: DateRange): Promise<TeamStats[]>
validateReportAccess(userId: string, orgId: string): Promise<boolean>