Skip to content

Commit

Permalink
fix: fix timeseries data bug
Browse files Browse the repository at this point in the history
  • Loading branch information
qmi03 committed May 18, 2024
1 parent 90208d1 commit 58f7bd3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/.env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FLASK_PORT=5000
FASTAPI_PORT=8000
MQTT_HOST=io.adafruit.com
MQTT_PORT=1883
ADAFRUIT_USER=tuankiet0303
ADAFRUIT_KEY=

MONGO_USER=root
MONGO_PASSWORD=example
HUGGINGFACE_KEY=
MONGO_PASSWORD=example
14 changes: 14 additions & 0 deletions app/Utils/convert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from typing import Any

from bson import ObjectId


def convert_objectid(data: Any) -> Any:
if isinstance(data, list):
return [convert_objectid(item) for item in data]
elif isinstance(data, dict):
return {key: convert_objectid(value) for key, value in data.items()}
elif isinstance(data, ObjectId):
return str(data)
else:
return data
5 changes: 3 additions & 2 deletions smarthome/.env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VITE_FLASK_HOST=http://127.0.0.1
VITE_FLASK_PORT=8000
VITE_FASTAPI_HOST=127.0.0.1
VITE_FASTAPI_PORT=8000
VITE_HUGGINGFACE_KEY=

0 comments on commit 58f7bd3

Please sign in to comment.