Service Layer medium complexity backend
2
Dependencies
0
Dependents
1
Entities
0
Integrations

Description

Computes rolled-up statistics for a given organization by aggregating data from all descendant organizations using nightly-refreshed PostgreSQL materialized views. Provides the data layer behind the rollup KPIs displayed on the hierarchy management page.

Feature: Multi-Organization Hierarchy

aggregate-report-service

Responsibilities

  • Query materialized views for pre-aggregated descendant statistics
  • Combine activity, user, and expense counts per org subtree
  • Trigger manual materialized view refresh for admin-requested recalculations
  • Format rollup results for consumption by the Hierarchy Management Page

Interfaces

getRollupStats(orgId): AggregateStats
refreshMaterializedViews(orgId?): void
getDescendantActivityCount(orgId): number
getDescendantUserCount(orgId): number
getDescendantExpenseTotal(orgId): number
getLastRefreshTimestamp(): Date

Relationships

Dependencies (2)

Components this component depends on

Related Data Entities (1)

Data entities managed by this component