Skip to content

Conversation

@hbbayrak
Copy link

Summary

When no organizations exist, the settings page displays an initial setup wizard that allows superadmin to configure:

  • Deployment settings (name, country, admin levels, metabase URL, funding sources)
  • First organization with service toggles
  • First admin user with permissions

Changes

Server

  • InitialSetupRequest.cs: New request model with validation attributes
  • SettingsController.cs: New POST /initial-setup endpoint with atomic transaction

Client

  • SettingsPage.tsx: Refactored to show setup wizard when no orgs exist
  • DeploymentSettingsFields.tsx: Shared component for deployment settings (reduces duplication)
  • validations.ts: Added InitialSetupFormSchema with required field validation
  • organizations/api.ts: Added useHasOrganizations() hook for setup detection

Features

  • Server-side validation with Data Annotations
  • Client-side validation with Zod schemas
  • Atomic transaction ensuring all-or-nothing setup
  • Shared component for code reuse between setup and normal settings modes

Test Plan

  • Fresh database: Login as superadmin, verify setup wizard appears
  • Fill all required fields, submit - verify org and user created
  • Logout, login with new admin account - verify full app access
  • Refresh settings page - verify setup wizard no longer appears
  • Try setup endpoint again - verify it fails (already initialized)

When no organizations exist, the settings page displays an initial setup
wizard that allows superadmin to configure:
- Deployment settings (name, country, admin levels, metabase URL, funding sources)
- First organization with service toggles
- First admin user with permissions

Features:
- Server-side validation with Data Annotations
- Client-side validation with Zod schemas
- Atomic transaction ensuring all-or-nothing setup
- Shared DeploymentSettingsFields component for code reuse
- useHasOrganizations hook for setup detection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant