(scope: 'user' | 'org' | 'admin')
| 481 | * Returns a SQL expression that formats the time column as a string bucket, |
| 482 | * matching the granularity the caller requested. |
| 483 | * |
| 484 | * Hourly → 'YYYY-MM-DD HH24:MI:SS' (matches what Postgres timestamp::text returns) |
| 485 | * Day → 'YYYY-MM-DD' |
| 486 | * Week → 'YYYY-MM-DD' of the Monday-aligned week start |
| 487 | * Month → 'YYYY-MM-DD' of the first of the month (from daily table) |
| 488 | */ |
| 489 | function bucketExprSql(effectiveGranularity: Granularity, tier: GranularityTier): string { |
| 490 | const timeCol = getTimeColumn(tier); |
no test coverage detected