fix(admin): prefer non-anonymized map locations
CI / validate (push) Successful in 6m9s
Release / release (push) Successful in 8m18s

This commit is contained in:
dmg
2026-08-07 18:36:59 -04:00
parent 6425a5056a
commit 20dfc58d63
5 changed files with 30 additions and 7 deletions
+2 -1
View File
@@ -5,7 +5,7 @@ import Link from "next/link";
import { UserWorldMap, type UserMapLocation } from "@/components/user-world-map";
import { db } from "@/lib/database";
import { fillDailySeries, mergeRiskActivity, type DailyCount } from "@/lib/admin-metrics";
import { parseUserLocation, parseUserNetwork } from "@/lib/user-location-map";
import { MAP_LOCATION_CLASSIFICATIONS, parseUserLocation, parseUserNetwork } from "@/lib/user-location-map";
export const dynamic = "force-dynamic";
@@ -58,6 +58,7 @@ export default async function AdminDashboardPage() {
))
.where(and(
isNotNull(ipObservations.userId),
inArray(ipIntelligence.classification, MAP_LOCATION_CLASSIFICATIONS),
sql`case when jsonb_typeof(${ipIntelligence.rawResponse}->'location'->'latitude') = 'number' then (${ipIntelligence.rawResponse}->'location'->>'latitude')::double precision between -90 and 90 else false end`,
sql`case when jsonb_typeof(${ipIntelligence.rawResponse}->'location'->'longitude') = 'number' then (${ipIntelligence.rawResponse}->'location'->>'longitude')::double precision between -180 and 180 else false end`,
))