Upload batches of users onto firebase

This commit is contained in:
Carlos Mesquita
2024-09-03 20:09:19 +01:00
parent 06a8384f42
commit 7b5e10fd79
9 changed files with 336 additions and 15 deletions

15
app.py
View File

@@ -21,6 +21,7 @@ from heygen.AvatarEnum import AvatarEnum
from modules import GPT
from modules.training_content import TrainingContentService, TrainingContentKnowledgeBase
from modules.upload_level import UploadLevelService
from modules.batch_users import BatchUsers
load_dotenv()
@@ -48,6 +49,8 @@ tc_service = TrainingContentService(kb, open_ai, firestore_client)
upload_level_service = UploadLevelService(open_ai)
batch_users_service = BatchUsers(firestore_client)
thread_event = threading.Event()
# Configure logging
@@ -1695,8 +1698,7 @@ def grading_summary():
@jwt_required()
def training_content():
try:
data = request.get_json()
return tc_service.get_tips(data)
return tc_service.get_tips(request.get_json())
except Exception as e:
app.logger.error(str(e))
return str(e)
@@ -1715,5 +1717,14 @@ def upload_file():
return upload_level_service.generate_level_from_file(file), 200
@app.route('/batch_users', methods=['POST'])
def create_users_batch():
try:
return batch_users_service.batch_users(request.get_json())
except Exception as e:
app.logger.error(str(e))
return str(e)
if __name__ == '__main__':
app.run()