diff --git a/app/.env.example b/app/.env.example index 2d1e293..5722df4 100644 --- a/app/.env.example +++ b/app/.env.example @@ -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= \ No newline at end of file +MONGO_PASSWORD=example \ No newline at end of file diff --git a/app/Utils/convert.py b/app/Utils/convert.py new file mode 100644 index 0000000..84fb9e3 --- /dev/null +++ b/app/Utils/convert.py @@ -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 diff --git a/smarthome/.env.example b/smarthome/.env.example index 404de0e..5343892 100644 --- a/smarthome/.env.example +++ b/smarthome/.env.example @@ -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= \ No newline at end of file