fix(sites): fix site CRUD crashes and silent form errors

- Fix AttributeError in sites router: CurrentUser has `user_id` not `id`
  (create/update/delete all crashed with 500)
- Add onError handlers with toast notifications to SiteFormDialog

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jason Staack
2026-03-19 17:42:58 -05:00
parent 4e917ac819
commit dffea763f6
2 changed files with 14 additions and 3 deletions

View File

@@ -83,7 +83,7 @@ async def create_site(
"""Create a new site. Requires operator role or above."""
await _check_tenant_access(current_user, tenant_id, db)
return await site_service.create_site(
db=db, tenant_id=tenant_id, data=data, user_id=current_user.id
db=db, tenant_id=tenant_id, data=data, user_id=current_user.user_id
)
@@ -103,7 +103,7 @@ async def update_site(
"""Update a site. Requires operator role or above."""
await _check_tenant_access(current_user, tenant_id, db)
return await site_service.update_site(
db=db, tenant_id=tenant_id, site_id=site_id, data=data, user_id=current_user.id
db=db, tenant_id=tenant_id, site_id=site_id, data=data, user_id=current_user.user_id
)
@@ -122,7 +122,7 @@ async def delete_site(
"""Delete a site. Requires tenant_admin or above."""
await _check_tenant_access(current_user, tenant_id, db)
await site_service.delete_site(
db=db, tenant_id=tenant_id, site_id=site_id, user_id=current_user.id
db=db, tenant_id=tenant_id, site_id=site_id, user_id=current_user.user_id
)