feature: Added Transactions and major Order System Overhaul
This commit is contained in:
@@ -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 = (
|
||||
|
||||
Reference in New Issue
Block a user