Standardize demo account type naming from inconsistent variants to clean names: - individual_bakery, professional_bakery → professional - central_baker, enterprise_chain → enterprise This eliminates naming confusion that was causing bugs in the demo session initialization, particularly for enterprise demo tenants where different parts of the system used different names for the same concept. Changes: - Updated source of truth in demo_session config - Updated all backend services (middleware, cloning, orchestration) - Updated frontend types, pages, and stores - Updated demo session models and schemas - Removed all backward compatibility code as requested Related to: Enterprise demo session access fix 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
"""
|
|
Demo Accounts API - Public demo account information (ATOMIC READ)
|
|
"""
|
|
|
|
from fastapi import APIRouter
|
|
from typing import List
|
|
import structlog
|
|
|
|
from app.api.schemas import DemoAccountInfo
|
|
from app.core import settings
|
|
from shared.routing import RouteBuilder
|
|
|
|
router = APIRouter(tags=["demo-accounts"])
|
|
logger = structlog.get_logger()
|
|
|
|
route_builder = RouteBuilder('demo')
|
|
|
|
|
|
@router.get(
|
|
route_builder.build_base_route("accounts", include_tenant_prefix=False),
|
|
response_model=List[DemoAccountInfo]
|
|
)
|
|
async def get_demo_accounts():
|
|
"""Get public demo account information (ATOMIC READ)"""
|
|
accounts = []
|
|
|
|
for account_type, config in settings.DEMO_ACCOUNTS.items():
|
|
accounts.append({
|
|
"account_type": account_type,
|
|
"name": config["name"],
|
|
"email": config["email"],
|
|
"password": "DemoSanPablo2024!" if "sanpablo" in config["email"] else "DemoLaEspiga2024!",
|
|
"description": (
|
|
"Panadería individual que produce todo localmente"
|
|
if account_type == "professional"
|
|
else "Punto de venta con obrador central"
|
|
),
|
|
"features": (
|
|
["Gestión de Producción", "Recetas", "Inventario", "Ventas", "Previsión de Demanda"]
|
|
if account_type == "professional"
|
|
else ["Gestión de Proveedores", "Pedidos", "Inventario", "Ventas", "Previsión de Demanda"]
|
|
),
|
|
"business_model": (
|
|
"Producción Local" if account_type == "professional" else "Obrador Central + Punto de Venta"
|
|
)
|
|
})
|
|
|
|
return accounts
|