feat: implement billing, usage tracking, and administrative geocoding features in API with infrastructure updates

This commit is contained in:
Hamza-Ayed
2026-07-28 04:43:23 +03:00
parent 2f7c2066f7
commit dc9d546733
133 changed files with 3599 additions and 356 deletions
+7 -3
View File
@@ -30,12 +30,13 @@ docker compose exec -T db psql -U mapuser -d mapdb -t -A -X > "${DELTA_OSM}" 2>/
WITH ways AS (
SELECT id, confidence, "uniqueDriverCount" AS drivers,
COALESCE(highway, 'residential') AS highway,
COALESCE(oneway, 0) AS oneway,
start_node, end_node,
ROW_NUMBER() OVER (ORDER BY id) AS way_seq
FROM approved_roads
),
pts AS (
SELECT w.way_seq, w.confidence, w.drivers, w.highway, w.start_node, w.end_node,
SELECT w.way_seq, w.confidence, w.drivers, w.highway, w.oneway, w.start_node, w.end_node,
dp.path[1] AS pt_order,
COUNT(*) OVER (PARTITION BY w.way_seq) AS npts,
ST_Y(dp.geom) AS lat, ST_X(dp.geom) AS lon
@@ -64,13 +65,16 @@ nodes_xml AS (
ways_xml AS (
SELECT string_agg(w.x, E'\n') AS x FROM (
SELECT format(
' <way id="%s" version="1">%s%s%s%s%s </way>',
' <way id="%s" version="1">%s%s%s%s%s%s </way>',
-way_seq,
string_agg(format(E'\n <nd ref="%s"/>', node_ref), '' ORDER BY pt_order),
format(E'\n <tag k="highway" v="%s"/>', min(highway)),
E'\n <tag k="source" v="intaleq:telemetry"/>',
format(E'\n <tag k="confidence" v="%s"/>', round(min(confidence)::numeric, 2)),
format(E'\n <tag k="intaleq:drivers" v="%s"/>\n', min(drivers))
format(E'\n <tag k="intaleq:drivers" v="%s"/>', min(drivers)),
CASE WHEN min(oneway) = 1 THEN E'\n <tag k="oneway" v="yes"/>'
WHEN min(oneway) = -1 THEN E'\n <tag k="oneway" v="-1"/>'
ELSE '' END
) AS x
FROM pts_ref GROUP BY way_seq
) w
+4 -2
View File
@@ -63,9 +63,11 @@ mv "$TMP" "$PBF"
# ── إعادة بناء الرسم ─────────────────────────────────────────────────────
# GraphHopper لا يعيد قراءة الـ PBF إن كان graph-cache موجوداً.
echo "🧹 حذف graph-cache وإعادة بناء الرسم..."
# نحذف المجلدين: graph-cache (من إعدادنا) و default-gh (اسم GraphHopper
# الافتراضي، وهو المستخدم فعلياً إن لم يُقرأ config.yml).
echo "🧹 حذف الرسم المخزّن وإعادة البناء..."
docker compose stop routing || true
rm -rf "$DATA_DIR/graph-cache"
rm -rf "$DATA_DIR/graph-cache" "$DATA_DIR/default-gh"
docker compose up -d routing
echo "⏳ انتظار جهوزية المحرك (قد يستغرق البناء عدة دقائق)..."