feature: Added Transactions and major Order System Overhaul

This commit is contained in:
2026-03-25 10:32:47 +02:00
parent 2d57c75d2f
commit b2d1e2bdc4
8 changed files with 1089 additions and 123 deletions

View File

@@ -72,7 +72,7 @@ def _convert_firestore_value(val):
# Firestore DatetimeWithNanoseconds is a datetime subclass
return val.strftime("%d %B %Y at %H:%M:%S UTC%z")
if isinstance(val, GeoPoint):
return f"{val.latitude}° N, {val.longitude}° E"
return {"lat": val.latitude, "lng": val.longitude}
if isinstance(val, DocumentReference):
# Store the document path (e.g. "users/abc123")
return val.path
@@ -213,6 +213,11 @@ def update_device(device_doc_id: str, data: DeviceUpdate) -> DeviceInDB:
update_data = data.model_dump(exclude_none=True)
# Convert {lat, lng} dict to a Firestore GeoPoint
coords = update_data.get("device_location_coordinates")
if isinstance(coords, dict) and "lat" in coords and "lng" in coords:
update_data["device_location_coordinates"] = GeoPoint(coords["lat"], coords["lng"])
# Deep-merge nested structs so unmentioned sub-fields are preserved
existing = doc.to_dict()
nested_keys = (