|
|
|
@ -12,7 +12,7 @@ from src.config import WINDOWS_AEROS_BASE_URL
|
|
|
|
from src.database.core import DbSession
|
|
|
|
from src.database.core import DbSession
|
|
|
|
from src.database.service import CommonParameters
|
|
|
|
from src.database.service import CommonParameters
|
|
|
|
from src.models import StandardResponse
|
|
|
|
from src.models import StandardResponse
|
|
|
|
|
|
|
|
from src.aeros_utils import aeros_post
|
|
|
|
from .schema import AerosProjectInput, AerosMetadata, OverhaulScheduleCreate, OverhaulScheduleUpdate
|
|
|
|
from .schema import AerosProjectInput, AerosMetadata, OverhaulScheduleCreate, OverhaulScheduleUpdate
|
|
|
|
from .service import import_aro_project, fetch_aro_record, reset_project, create, update, delete
|
|
|
|
from .service import import_aro_project, fetch_aro_record, reset_project, create, update, delete
|
|
|
|
|
|
|
|
|
|
|
|
@ -48,12 +48,15 @@ async def forward_download(db_session: DbSession):
|
|
|
|
|
|
|
|
|
|
|
|
project = data.scalar_one_or_none()
|
|
|
|
project = data.scalar_one_or_none()
|
|
|
|
filename = f"{project.project_name}.aro"
|
|
|
|
filename = f"{project.project_name}.aro"
|
|
|
|
url = f"{WINDOWS_AEROS_BASE_URL}/download/{filename}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async with httpx.AsyncClient() as client:
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# Download entire file (no streaming)
|
|
|
|
# Download entire file (no streaming)
|
|
|
|
response = await client.get(url)
|
|
|
|
response = await aeros_post(
|
|
|
|
|
|
|
|
"/download",
|
|
|
|
|
|
|
|
json={
|
|
|
|
|
|
|
|
"filename": filename
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
if response.status_code != 200:
|
|
|
|
if response.status_code != 200:
|
|
|
|
raise HTTPException(
|
|
|
|
raise HTTPException(
|
|
|
|
@ -65,8 +68,7 @@ async def forward_download(db_session: DbSession):
|
|
|
|
|
|
|
|
|
|
|
|
# Extract headers
|
|
|
|
# Extract headers
|
|
|
|
# Force a secure/default filename for the client
|
|
|
|
# Force a secure/default filename for the client
|
|
|
|
secure_filename = "rbd_project_export.aro"
|
|
|
|
content_disposition = f'attachment; filename="{filename}"'
|
|
|
|
content_disposition = f'attachment; filename="{secure_filename}"'
|
|
|
|
|
|
|
|
media_type = response.headers.get(
|
|
|
|
media_type = response.headers.get(
|
|
|
|
"content-type",
|
|
|
|
"content-type",
|
|
|
|
"application/octet-stream"
|
|
|
|
"application/octet-stream"
|
|
|
|
|