REFACTOR API gateway fix 5

This commit is contained in:
Urtzi Alfaro
2025-07-26 21:10:54 +02:00
parent dacf114922
commit 7d5c8bc9a4
6 changed files with 91 additions and 19 deletions

View File

@@ -173,7 +173,7 @@ async def import_sales_data(
current_user: Dict[str, Any] = Depends(get_current_user_dep),
db: AsyncSession = Depends(get_db)
):
"""Import sales data from file for tenant"""
"""Import sales data from file for tenant - FIXED VERSION"""
try:
logger.info("Importing sales data",
tenant_id=tenant_id,
@@ -185,7 +185,7 @@ async def import_sales_data(
content = await file.read()
file_content = content.decode('utf-8')
# Process import
# ✅ FIX: tenant_id comes from URL path, not file upload
result = await DataImportService.process_upload(
tenant_id,
file_content,
@@ -198,7 +198,7 @@ async def import_sales_data(
# Publish event
try:
await publish_data_imported({
"tenant_id": tenant_id,
"tenant_id": str(tenant_id), # Ensure string conversion
"type": "file_import",
"format": file_format,
"filename": file.filename,