|
|
|
|
@ -9,13 +9,13 @@ from sqlalchemy.orm import selectinload
|
|
|
|
|
from src.aeros_equipment.service import save_default_equipment
|
|
|
|
|
from src.aeros_simulation.service import save_default_simulation_node
|
|
|
|
|
from src.auth.service import CurrentUser
|
|
|
|
|
from src.config import WINDOWS_AEROS_BASE_URL
|
|
|
|
|
from src.config import WINDOWS_AEROS_BASE_URL, AEROS_BASE_URL
|
|
|
|
|
from src.database.core import DbSession
|
|
|
|
|
from src.database.service import search_filter_sort_paginate
|
|
|
|
|
|
|
|
|
|
from .model import AerosProject
|
|
|
|
|
from .schema import AerosProjectInput
|
|
|
|
|
|
|
|
|
|
import asyncio
|
|
|
|
|
ALLOWED_EXTENSIONS = {".aro"}
|
|
|
|
|
MAX_FILE_SIZE = 100 * 1024 * 1024 # 100MB
|
|
|
|
|
client = httpx.AsyncClient(timeout=300.0)
|
|
|
|
|
@ -93,6 +93,8 @@ async def import_aro_project(*, db_session: DbSession, aeros_project_in: AerosPr
|
|
|
|
|
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
await asyncio.sleep(2)
|
|
|
|
|
|
|
|
|
|
# aro_path = r"C:/Users/user/Documents/Aeros/sample_project.aro"
|
|
|
|
|
|
|
|
|
|
aeros_project = AerosProject(project_name=project_name, aro_file_path=aro_path)
|
|
|
|
|
@ -113,22 +115,22 @@ async def import_aro_project(*, db_session: DbSession, aeros_project_in: AerosPr
|
|
|
|
|
|
|
|
|
|
# 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)
|
|
|
|
|
# )
|
|
|
|
|
|
|
|
|
|
# await _initialize_default_project_data(
|
|
|
|
|
# db_session=db_session,
|
|
|
|
|
# project_name=project_name
|
|
|
|
|
# )
|
|
|
|
|
try:
|
|
|
|
|
response = await client.post(
|
|
|
|
|
f"{AEROS_BASE_URL}/api/Project/ImportAROFile",
|
|
|
|
|
content='"D:/aro/trialapi.aro"',
|
|
|
|
|
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,
|
|
|
|
|
project_name=project_name
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
async def fetch_aro_record(*, db_session: DbSession):
|
|
|
|
|
stmt = select(AerosProject).order_by(desc(AerosProject.updated_at)).limit(1)
|
|
|
|
|
|