forked from cardosofelipe/fast-next-template
feat(demo): tie all demo projects to admin user
- Update demo_data.json to use "__admin__" as owner_email for all projects - Add admin user lookup in load_demo_data() with special "__admin__" key - Remove notification_email from project settings (not a valid field) This ensures demo projects are visible to the admin user when logged in. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
# ========================
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user