|
|
|
@ -64,7 +64,7 @@ async def import_aro_project(*, db_session: DbSession, aeros_project_in: AerosPr
|
|
|
|
|
|
|
|
|
|
|
|
# Prepare file for upload
|
|
|
|
# Prepare file for upload
|
|
|
|
files = {
|
|
|
|
files = {
|
|
|
|
"file": (file.filename, content, file.content_type or "application/octet-stream")
|
|
|
|
"file": (file.filename.replace(" ", "_"), content, file.content_type or "application/octet-stream")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
response = await client.post(
|
|
|
|
response = await client.post(
|
|
|
|
@ -76,6 +76,7 @@ async def import_aro_project(*, db_session: DbSession, aeros_project_in: AerosPr
|
|
|
|
# Get the file path from the response
|
|
|
|
# Get the file path from the response
|
|
|
|
upload_result = response.json()
|
|
|
|
upload_result = response.json()
|
|
|
|
aro_path = upload_result.get("full_path")
|
|
|
|
aro_path = upload_result.get("full_path")
|
|
|
|
|
|
|
|
filename = upload_result.get("stored_filename").replace(".aro", "")
|
|
|
|
|
|
|
|
|
|
|
|
if not aro_path:
|
|
|
|
if not aro_path:
|
|
|
|
raise HTTPException(
|
|
|
|
raise HTTPException(
|
|
|
|
@ -97,7 +98,7 @@ async def import_aro_project(*, db_session: DbSession, aeros_project_in: AerosPr
|
|
|
|
|
|
|
|
|
|
|
|
# aro_path = r"C:/Users/user/Documents/Aeros/sample_project.aro"
|
|
|
|
# aro_path = r"C:/Users/user/Documents/Aeros/sample_project.aro"
|
|
|
|
|
|
|
|
|
|
|
|
aeros_project = AerosProject(project_name=project_name, aro_file_path=aro_path)
|
|
|
|
aeros_project = AerosProject(project_name=filename, aro_file_path=aro_path)
|
|
|
|
|
|
|
|
|
|
|
|
# find aeros record first, if not found, then create a new one
|
|
|
|
# find aeros record first, if not found, then create a new one
|
|
|
|
stmt = select(AerosProject).order_by(desc(AerosProject.created_at)).limit(1)
|
|
|
|
stmt = select(AerosProject).order_by(desc(AerosProject.created_at)).limit(1)
|
|
|
|
@ -129,7 +130,7 @@ async def import_aro_project(*, db_session: DbSession, aeros_project_in: AerosPr
|
|
|
|
|
|
|
|
|
|
|
|
await _initialize_default_project_data(
|
|
|
|
await _initialize_default_project_data(
|
|
|
|
db_session=db_session,
|
|
|
|
db_session=db_session,
|
|
|
|
project_name=project_name
|
|
|
|
project_name=filename
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
async def fetch_aro_record(*, db_session: DbSession):
|
|
|
|
async def fetch_aro_record(*, db_session: DbSession):
|
|
|
|
|