From 87daf1527ce37787e49d56d4fb01ed96a9d7dce8 Mon Sep 17 00:00:00 2001 From: Cizz22 Date: Mon, 23 Jun 2025 17:42:24 +0700 Subject: [PATCH] fix minor --- src/aeros_equipment/router.py | 1 + src/aeros_equipment/service.py | 15 ++++++++------- src/aeros_project/service.py | 22 +++++++++++----------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/aeros_equipment/router.py b/src/aeros_equipment/router.py index 54d33b7..aaa7ba9 100644 --- a/src/aeros_equipment/router.py +++ b/src/aeros_equipment/router.py @@ -21,6 +21,7 @@ async def get_all_simulation(db_session: DbSession, common: CommonParameters): results = await get_all(common = common) + return {"data": results, "status": "success", "message": "Success"} diff --git a/src/aeros_equipment/service.py b/src/aeros_equipment/service.py index 7246742..095b430 100644 --- a/src/aeros_equipment/service.py +++ b/src/aeros_equipment/service.py @@ -23,27 +23,26 @@ async def get_all(*, common): selectinload(AerosEquipment.aeros_equipment_details) ) results = await search_filter_sort_paginate(model=query, **common) + reg_nodes = [node.node_name for node in results["items"]] - requestedNode = { - "projectName": "ParallelNode", - "equipmentName": [node.node_name for node in results["items"]], - } + updateNodeReq = {"projectName": "trialapi", "equipmentNames": reg_nodes} try: response = await client.post( f"{AEROS_BASE_URL}/api/UpdateDisParams/GetUpdatedNodeDistributions", - json=requestedNode, + json=updateNodeReq, headers={"Content-Type": "application/json"}, ) response.raise_for_status() - aerosEquipmentResult = response.json() + + res = response.json() except Exception as e: raise HTTPException( status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e) ) - results["items"] = aerosEquipmentResult + results["items"] = res return results @@ -131,6 +130,8 @@ async def save_default_equipment(*, db_session: DbSession, project_name: str): results = response.json() + raise Exception(updateNodeReq) + nodes = [] # save to db diff --git a/src/aeros_project/service.py b/src/aeros_project/service.py index 129f472..54f5d65 100644 --- a/src/aeros_project/service.py +++ b/src/aeros_project/service.py @@ -53,17 +53,17 @@ async def import_aro_project(*, db_session: DbSession): # Update path to AEROS APP # Example BODy "C/dsad/dsad.aro" - try: - response = await client.post( - f"{AEROS_BASE_URL}/api/Project/ImportAROFile", - json=f"/", - headers={"Content-Type": "application/json"}, - ) - response.raise_for_status() - except Exception as e: - raise HTTPException( - status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e) - ) + # try: + # response = await client.post( + # f"{AEROS_BASE_URL}/api/Project/ImportAROFile", + # json=f"/", + # headers={"Content-Type": "application/json"}, + # ) + # response.raise_for_status() + # except Exception as e: + # raise HTTPException( + # status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e) + # ) await _initialize_default_project_data( db_session=db_session,