Service Layer high complexity backend
0
Dependencies
1
Dependents
1
Entities
0
Integrations

Description

Server-side query builder class that translates declarative report specifications into parameterized SQL queries. Validates all fields against an allowlist, enforces tenant isolation via organization_id WHERE clauses, and applies complexity guards to prevent expensive queries.

Feature: Custom Reports

report-query-builder

Responsibilities

  • Translate field selections into SELECT clauses with proper joins
  • Build WHERE clauses from filter conditions with parameterized values
  • Apply GROUP BY and ORDER BY from specification
  • Enforce organization_id tenant isolation on all queries
  • Reject queries exceeding complexity limits

Interfaces

buildQuery(specification, orgId)
buildCountQuery(specification, orgId)
validateFields(fieldIds)
getRequiredJoins(fieldIds)
estimateQueryComplexity(specification)
buildFilterClause(filters)
buildGroupByClause(groupFields)
buildOrderByClause(sortConfig)

Relationships

Dependents (1)

Components that depend on this component

Related Data Entities (1)

Data entities managed by this component