Files
porthole/apps/web/app/api/geo/route.ts
2026-02-04 16:44:57 -08:00

30 lines
565 B
TypeScript

import { getDb } from "@tline/db";
import { shapeGeoRows } from "./shape";
export const runtime = "nodejs";
export async function GET(): Promise<Response> {
const db = getDb();
const rows = await db<
{
id: string;
gps_lat: number | null;
gps_lon: number | null;
}[]
>`
select
a.id,
a.gps_lat,
a.gps_lon
from assets a
where a.gps_lat is not null
and a.gps_lon is not null
order by a.capture_ts_utc asc nulls last, a.id asc
limit 1000
`;
return Response.json(shapeGeoRows(rows));
}