Adm global

This commit is contained in:
2026-03-11 09:26:36 -06:00
parent 3f7b166767
commit 12cbbd1b80
29 changed files with 61 additions and 672 deletions

View File

@@ -481,6 +481,7 @@ async def get_current_user(
"role": user.role.value if hasattr(user.role, 'value') else user.role,
"tenant_id": str(user.tenant_id),
"tenant_name": user.tenant.name if user.tenant else None,
"tenant_slug": user.tenant.slug if user.tenant else None,
"is_active": user.is_active,
"is_two_factor_enabled": user.totp_secret is not None,
"last_login": user.last_login.isoformat() if user.last_login else None,

View File

@@ -34,7 +34,9 @@ async def create_tenant(
if result.scalar_one_or_none():
raise HTTPException(status_code=400, detail="Tenant slug already exists")
db_tenant = Tenant(**tenant.model_dump())
data = tenant.model_dump()
data['slug'] = data['slug'].lower().strip()
db_tenant = Tenant(**data)
db.add(db_tenant)
await db.commit()
await db.refresh(db_tenant)