se agregaron nuevas caracteristicas

This commit is contained in:
Carlos Tello
2026-08-13 23:07:01 -03:00
parent 1bfb808c79
commit d736db982e
23 changed files with 1244 additions and 100 deletions
+17
View File
@@ -67,6 +67,23 @@ async def get_dashboard_stats(
# Storage metrics
storage_stats = await storage_provider.get_storage_stats()
# Override with global virtual quota if set
from app.services.settings_service import get_setting
global_quota_gb_str = await get_setting(db, "global_quota_gb")
if global_quota_gb_str:
try:
global_quota_bytes = int(global_quota_gb_str) * 1024 * 1024 * 1024
# Sum up storage used by all clients
used_res = await db.execute(select(func.sum(Client.storage_used_bytes)))
total_used_bytes = used_res.scalar() or 0
storage_stats["total_bytes"] = global_quota_bytes
storage_stats["used_bytes"] = total_used_bytes
storage_stats["free_bytes"] = max(0, global_quota_bytes - total_used_bytes)
storage_stats["usage_percent"] = round((total_used_bytes / global_quota_bytes) * 100, 2) if global_quota_bytes > 0 else 0
except ValueError:
pass
return {
"total_clients": total_clients,