Browse Source

support workspace billing info (#15510)

tags/1.0.1
Jyong 7 months ago
parent
commit
da01b460fe
No account linked to committer's email address
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      api/controllers/console/workspace/workspace.py

+ 6
- 0
api/controllers/console/workspace/workspace.py View File

from libs.login import login_required from libs.login import login_required
from models.account import Tenant, TenantStatus from models.account import Tenant, TenantStatus
from services.account_service import TenantService from services.account_service import TenantService
from services.feature_service import FeatureService
from services.file_service import FileService from services.file_service import FileService
from services.workspace_service import WorkspaceService from services.workspace_service import WorkspaceService


tenants = TenantService.get_join_tenants(current_user) tenants = TenantService.get_join_tenants(current_user)


for tenant in tenants: for tenant in tenants:
features = FeatureService.get_features(tenant.id)
if features.billing.enabled:
tenant.plan = features.billing.subscription.plan
else:
tenant.plan = "sandbox"
if tenant.id == current_user.current_tenant_id: if tenant.id == current_user.current_tenant_id:
tenant.current = True # Set current=True for current tenant tenant.current = True # Set current=True for current tenant
return {"workspaces": marshal(tenants, tenants_fields)}, 200 return {"workspaces": marshal(tenants, tenants_fields)}, 200

Loading…
Cancel
Save