New enterprise feature

This commit is contained in:
Urtzi Alfaro
2025-11-30 09:12:40 +01:00
parent f9d0eec6ec
commit 972db02f6d
176 changed files with 19741 additions and 1361 deletions

View File

@@ -56,8 +56,8 @@ structlog.configure(
logger = structlog.get_logger()
# Fixed Demo Tenant IDs (must match tenant service)
DEMO_TENANT_SAN_PABLO = uuid.UUID("a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6") # Individual bakery
DEMO_TENANT_LA_ESPIGA = uuid.UUID("b2c3d4e5-f6a7-48b9-c0d1-e2f3a4b5c6d7") # Central bakery
DEMO_TENANT_PROFESSIONAL = uuid.UUID("a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6") # Individual bakery
DEMO_TENANT_ENTERPRISE_CHAIN = uuid.UUID("c3d4e5f6-a7b8-49c0-d1e2-f3a4b5c6d7e8") # Enterprise parent (Obrador)
# BASE_REFERENCE_DATE now imported from shared utilities to ensure consistency
# between seeding and cloning operations
@@ -154,7 +154,7 @@ def weighted_choice(choices: list) -> dict:
def generate_run_number(tenant_id: uuid.UUID, index: int, run_type: str) -> str:
"""Generate a unique run number"""
tenant_prefix = "SP" if tenant_id == DEMO_TENANT_SAN_PABLO else "LE"
tenant_prefix = "SP" if tenant_id == DEMO_TENANT_PROFESSIONAL else "LE"
type_code = run_type[0:3].upper()
current_year = datetime.now(timezone.utc).year
return f"ORCH-{tenant_prefix}-{type_code}-{current_year}-{index:03d}"
@@ -593,25 +593,25 @@ async def seed_all(db: AsyncSession):
results = []
# Seed San Pablo (Individual Bakery)
result_san_pablo = await generate_orchestration_for_tenant(
# Seed Professional Bakery (single location)
result_professional = await generate_orchestration_for_tenant(
db,
DEMO_TENANT_SAN_PABLO,
"Panadería San Pablo (Individual Bakery)",
DEMO_TENANT_PROFESSIONAL,
"Panadería Artesana Madrid (Professional)",
"individual_bakery",
config
)
results.append(result_san_pablo)
results.append(result_professional)
# Seed La Espiga (Central Bakery)
result_la_espiga = await generate_orchestration_for_tenant(
# Seed Enterprise Parent (central production - Obrador)
result_enterprise_parent = await generate_orchestration_for_tenant(
db,
DEMO_TENANT_LA_ESPIGA,
"Panadería La Espiga (Central Bakery)",
"central_bakery",
DEMO_TENANT_ENTERPRISE_CHAIN,
"Panadería Central - Obrador Madrid (Enterprise Parent)",
"enterprise_chain",
config
)
results.append(result_la_espiga)
results.append(result_enterprise_parent)
total_runs = sum(r["runs_created"] for r in results)
total_steps = sum(r["steps_created"] for r in results)