New enterprise feature
This commit is contained in:
@@ -33,8 +33,7 @@ from shared.utils.demo_dates import BASE_REFERENCE_DATE
|
||||
logger = structlog.get_logger()
|
||||
|
||||
# Base demo tenant IDs
|
||||
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
|
||||
|
||||
|
||||
def load_customer_data():
|
||||
@@ -89,7 +88,7 @@ async def seed_customers_for_tenant(
|
||||
|
||||
# Create customer (using actual model fields)
|
||||
# For San Pablo, use original IDs. For La Espiga, generate new UUIDs
|
||||
if tenant_id == DEMO_TENANT_SAN_PABLO:
|
||||
if tenant_id == DEMO_TENANT_PROFESSIONAL:
|
||||
customer_id = uuid.UUID(customer_data["id"])
|
||||
else:
|
||||
# Generate deterministic UUID for La Espiga based on original ID
|
||||
@@ -151,23 +150,14 @@ async def seed_all(db: AsyncSession):
|
||||
|
||||
results = []
|
||||
|
||||
# Both tenants get the same customer base
|
||||
# (In real scenario, you might want different customer lists)
|
||||
result_san_pablo = await seed_customers_for_tenant(
|
||||
# Seed Professional Bakery with customer base (merged from San Pablo + La Espiga)
|
||||
result_professional = await seed_customers_for_tenant(
|
||||
db,
|
||||
DEMO_TENANT_SAN_PABLO,
|
||||
"San Pablo - Individual Bakery",
|
||||
DEMO_TENANT_PROFESSIONAL,
|
||||
"Professional Bakery",
|
||||
data["clientes"]
|
||||
)
|
||||
results.append(result_san_pablo)
|
||||
|
||||
result_la_espiga = await seed_customers_for_tenant(
|
||||
db,
|
||||
DEMO_TENANT_LA_ESPIGA,
|
||||
"La Espiga - Central Bakery",
|
||||
data["clientes"]
|
||||
)
|
||||
results.append(result_la_espiga)
|
||||
results.append(result_professional)
|
||||
|
||||
total_created = sum(r["customers_created"] for r in results)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user