fix: include private locations in region count, fix graph bug (#2501) master
* fix: filter out soft-deleted private location assignments Added isNull(deletedAt) filter to privateLocationToMonitors query to exclude soft-deleted assignments when counting private locations per monitor. This was causing incorrect region counts. * fix: add privateLocationCount to monitor schema Added privateLocationCount field to selectPublicMonitorWithStatusSchema so Zod doesn't strip it during response parsing. This was the root cause of the field not appearing in the frontend. * fix: detect all regions across all data points in chart Changed region detection from only checking data[0] to checking all data points using flatMap and Set. This ensures all regions appear in the legend even if they don't have data at the most recent timestamp. Fixes issue where only 1 private location appeared in graph despite all 3 having data. * fix: add missing privateLocationToMonitors import and fix any type usage * ci: apply automated fixes * fix: add privateLocationCount field to status page monitors Adds a computed field that counts private locations per monitor to fix the region count display issue. The field is computed by querying the privateLocationToMonitors junction table and counting assignments per monitor ID. This approach avoids modifying the existing regions array which has a strict Zod schema validation for cloud region codes only. Instead, privateLocationCount is appended as a new field on each monitor, following the existing pattern of computed fields like status, events, monitorGroupId, etc. * fix: improve type safety by replacing 'as any' with 'as Record<string, unknown>' Addresses code review feedback about scattered type casts * fix: remove leftover merge conflict marker Removes conflict marker that was missed during cherry-pick resolution * ci: apply automated fixes * fix: use UTC time in test event helpers for consistent date overlap Changed createIncident, createReport, and createMaintenance to use UTC noon instead of local time. This ensures events reliably overlap with UTC-midnight status data days, fixing test failures caused by the services package refactor. Fixes: - Line 560: maintenance exclusion test now has proper overlap - Line 719: multiple days test now correctly detects maintenance as 'info' * fix: adjust event helpers to use UTC midnight for accurate duration calculations Changed from UTC noon to UTC midnight (00:00) so 24-hour events properly cover full days. This fixes uptime calculation tests while maintaining reliable overlap with UTC-midnight status data days. * refactor: remove unsafe type assertions for privateLocationCount Use optional chaining directly instead of type assertions since privateLocationCount is already defined as optional in the schema. Addresses maintainer feedback to avoid using 'as' type assertions. * refactor: remove type cast by using immutable map for privateLocationCount Replace mutating loop with non-mutating map to avoid 'as Record<string, unknown>' cast. Creates monitorsWithPrivateLocationCount array instead of mutating monitors directly, improving type safety and following CLAUDE.md Type Cast Discipline. * ci: apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>