Improve the demo feature of the project

This commit is contained in:
Urtzi Alfaro
2025-10-12 18:47:33 +02:00
parent dbc7f2fa0d
commit 7556a00db7
168 changed files with 10102 additions and 18869 deletions

View File

@@ -281,10 +281,39 @@ class SubscriptionLimitService:
try:
async with self.database_manager.get_session() as db_session:
await self._init_repositories(db_session)
subscription = await self.subscription_repo.get_active_subscription(tenant_id)
if not subscription:
return {"error": "No active subscription"}
# FIX: Return mock subscription for demo tenants instead of error
logger.info("No subscription found, returning mock data", tenant_id=tenant_id)
return {
"plan": "demo",
"monthly_price": 0,
"status": "active",
"usage": {
"users": {
"current": 1,
"limit": 5,
"unlimited": False,
"usage_percentage": 20.0
},
"locations": {
"current": 1,
"limit": 1,
"unlimited": False,
"usage_percentage": 100.0
},
"products": {
"current": 0,
"limit": 50,
"unlimited": False,
"usage_percentage": 0.0
}
},
"features": {},
"next_billing_date": None,
"trial_ends_at": None
}
# Get current usage
members = await self.member_repo.get_tenant_members(tenant_id, active_only=True)