diff --git a/backend/app/init_db.py b/backend/app/init_db.py index 899b36d..836cfa5 100644 --- a/backend/app/init_db.py +++ b/backend/app/init_db.py @@ -267,6 +267,15 @@ async def load_demo_data(session: AsyncSession) -> None: await session.flush() + # Add admin user to map with special "__admin__" key + # This allows demo data to reference the admin user as owner + superuser_email = settings.FIRST_SUPERUSER_EMAIL or "admin@example.com" + admin_user = await user_crud.get_by_email(session, email=superuser_email) + if admin_user: + user_map["__admin__"] = admin_user + user_map[str(admin_user.email)] = admin_user + logger.debug(f"Added admin user to map: {admin_user.email}") + # ======================== # 3. Load Agent Types Map (for FK resolution) # ======================== diff --git a/backend/data/demo_data.json b/backend/data/demo_data.json index 19d0a79..707de72 100644 --- a/backend/data/demo_data.json +++ b/backend/data/demo_data.json @@ -368,21 +368,20 @@ "name": "E-Commerce Platform Redesign", "slug": "ecommerce-redesign", "description": "Complete redesign of the e-commerce platform with modern UX, improved checkout flow, and mobile-first approach.", - "owner_email": "demo@example.com", + "owner_email": "__admin__", "autonomy_level": "milestone", "status": "active", "complexity": "complex", "client_mode": "technical", "settings": { - "mcp_servers": ["gitea", "knowledge-base"], - "notification_email": "demo@example.com" + "mcp_servers": ["gitea", "knowledge-base"] } }, { "name": "Mobile Banking App", "slug": "mobile-banking", "description": "Secure mobile banking application with biometric authentication, transaction history, and real-time notifications.", - "owner_email": "alice@acme.com", + "owner_email": "__admin__", "autonomy_level": "full_control", "status": "active", "complexity": "complex", @@ -396,7 +395,7 @@ "name": "Internal HR Portal", "slug": "hr-portal", "description": "Employee self-service portal for leave requests, performance reviews, and document management.", - "owner_email": "carol@globex.com", + "owner_email": "__admin__", "autonomy_level": "autonomous", "status": "active", "complexity": "medium",