Service Layer medium complexity Shared Component backend
0
Dependencies
1
Dependents
1
Entities
0
Integrations

Description

Utility service that constructs parameterized PostgreSQL aggregate queries for the team reports endpoint. Accepts filter parameters and tenant scope constraints, returning a safely parameterized query ready for execution. Separates query construction from execution to enable testing and reuse in Bufdir report generation.

Feature: Team Reports

report-query-builder

Responsibilities

  • Build parameterized GROUP BY aggregate queries over activities joined to organization_memberships
  • Apply date range, activity type, and org unit WHERE clauses from validated filter input
  • Construct pagination LIMIT/OFFSET clauses for chunked fetch
  • Produce reusable query fragments sharable with Bufdir report generation queries

Interfaces

buildTeamReportQuery(filters: ReportFilters, scope: TenantScope): ParameterizedQuery
buildSummaryQuery(filters: ReportFilters, scope: TenantScope): ParameterizedQuery
ParameterizedQuery: { sql: string, params: unknown[] }

Relationships

Dependents (1)

Components that depend on this component

Related Data Entities (1)

Data entities managed by this component