sprint3: dashboard counts per user + import owner_id + export visibility filter
This commit is contained in:
@@ -92,15 +92,21 @@ async def export_data(
|
||||
- format: 'csv' or 'xlsx' (default: csv)
|
||||
"""
|
||||
tenant_id = uuid.UUID(current_user["tenant_id"])
|
||||
user_id = uuid.UUID(current_user["user_id"])
|
||||
is_system_admin = current_user.get("is_system_admin", False)
|
||||
|
||||
# Determine filename based on entity_type
|
||||
filename = f"{entity_type}_export.csv"
|
||||
|
||||
# Fetch CSV data from the appropriate service function
|
||||
if entity_type == "contacts":
|
||||
csv_data = await import_export_service.export_contacts_csv(db, tenant_id)
|
||||
csv_data = await import_export_service.export_contacts_csv(
|
||||
db, tenant_id, user_id=user_id, is_system_admin=is_system_admin
|
||||
)
|
||||
elif entity_type == "companies":
|
||||
csv_data = await import_export_service.export_companies_csv(db, tenant_id)
|
||||
csv_data = await import_export_service.export_companies_csv(
|
||||
db, tenant_id, user_id=user_id, is_system_admin=is_system_admin
|
||||
)
|
||||
else:
|
||||
raise HTTPException(status_code=400, detail=f"Unsupported entity_type: {entity_type}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user