Dorabiamy funkcjonalnosci w TV

This commit is contained in:
dm
2025-12-12 14:58:13 +01:00
parent 0f17daee17
commit ee51e0816d
29 changed files with 1975 additions and 455 deletions

View File

@@ -0,0 +1,29 @@
import { getDb } from "../db.js";
export async function GET({ request }) {
const city = new URL(request.url).searchParams.get("city")?.trim() || "";
if (!city) {
return new Response(JSON.stringify({ hasStreets: false }), {
headers: { "Content-Type": "application/json; charset=utf-8" },
});
}
const db = getDb();
const row = db
.prepare(
`SELECT COUNT(*) AS cnt
FROM ranges
WHERE LOWER(city) = LOWER(?)
AND TRIM(street) <> ''`
)
.get(city);
return new Response(
JSON.stringify({ hasStreets: row.cnt > 0 }),
{
headers: { "Content-Type": "application/json; charset=utf-8" },
}
);
}