feat: implement full admin panel with dashboard, user management, and platform settings
Adds complete super_admin panel with 9 pages and account owner categories page. Backend includes 5 new DB tables, ~25 API endpoints, settings manager with in-memory cache, and 29 integration tests. Frontend includes reusable admin components (DataTable, Pagination, ActionMenu, etc.) with code-split lazy loading. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
130
frontend/src/types/admin.ts
Normal file
130
frontend/src/types/admin.ts
Normal file
@@ -0,0 +1,130 @@
|
||||
// Admin panel types - aligned with backend schemas/admin.py
|
||||
|
||||
export interface DashboardMetrics {
|
||||
total_users: number
|
||||
active_subscriptions: number
|
||||
paid_accounts: number
|
||||
total_trees: number
|
||||
}
|
||||
|
||||
export interface ActivityEntry {
|
||||
id: string
|
||||
user_email: string | null
|
||||
action: string
|
||||
resource_type: string
|
||||
resource_id: string | null
|
||||
details: Record<string, unknown> | null
|
||||
ip_address: string | null
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface AuditLogEntry {
|
||||
id: string
|
||||
user_id: string
|
||||
user_email: string | null
|
||||
action: string
|
||||
resource_type: string
|
||||
resource_id: string | null
|
||||
details: Record<string, unknown> | null
|
||||
ip_address: string | null
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface AuditLogListResponse {
|
||||
items: AuditLogEntry[]
|
||||
total: number
|
||||
page: number
|
||||
per_page: number
|
||||
}
|
||||
|
||||
export interface PlanLimitConfig {
|
||||
plan: string
|
||||
max_trees: number | null
|
||||
max_sessions_per_month: number | null
|
||||
max_users: number | null
|
||||
custom_branding: boolean
|
||||
priority_support: boolean
|
||||
export_formats: string[]
|
||||
}
|
||||
|
||||
export interface AccountOverrideResponse {
|
||||
id: string
|
||||
account_id: string
|
||||
account_name: string | null
|
||||
account_display_code: string | null
|
||||
override_max_trees: number | null
|
||||
override_max_sessions_per_month: number | null
|
||||
override_max_users: number | null
|
||||
note: string | null
|
||||
created_at: string
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface PlanDefaultEntry {
|
||||
plan: string
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
export interface FeatureFlagResponse {
|
||||
id: string
|
||||
flag_key: string
|
||||
display_name: string
|
||||
description: string | null
|
||||
plan_defaults: PlanDefaultEntry[]
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface AccountFeatureOverrideResponse {
|
||||
id: string
|
||||
account_id: string
|
||||
account_display_code: string | null
|
||||
flag_id: string
|
||||
flag_key: string | null
|
||||
flag_display_name: string | null
|
||||
enabled: boolean
|
||||
note: string | null
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface AdminCategory {
|
||||
id: string
|
||||
name: string
|
||||
slug: string
|
||||
description: string | null
|
||||
account_id: string | null
|
||||
tree_count: number
|
||||
}
|
||||
|
||||
// Request types
|
||||
export interface AccountOverrideCreate {
|
||||
account_display_code: string
|
||||
override_max_trees?: number | null
|
||||
override_max_sessions_per_month?: number | null
|
||||
override_max_users?: number | null
|
||||
note?: string | null
|
||||
}
|
||||
|
||||
export interface FeatureFlagCreate {
|
||||
flag_key: string
|
||||
display_name: string
|
||||
description?: string | null
|
||||
}
|
||||
|
||||
export interface PlanDefaultUpdate {
|
||||
plan: string
|
||||
flag_id: string
|
||||
enabled: boolean
|
||||
}
|
||||
|
||||
export interface AccountFeatureOverrideCreate {
|
||||
account_display_code: string
|
||||
flag_id: string
|
||||
enabled: boolean
|
||||
note?: string | null
|
||||
}
|
||||
|
||||
export interface GlobalCategoryCreate {
|
||||
name: string
|
||||
slug: string
|
||||
description?: string | null
|
||||
}
|
||||
@@ -8,6 +8,7 @@ export * from './category'
|
||||
export * from './folder'
|
||||
export * from './step'
|
||||
export type { Account, Subscription, PlanLimits, SubscriptionDetails, AccountInvite, AccountMember } from './account'
|
||||
export * from './admin'
|
||||
|
||||
// API response wrapper types
|
||||
export interface PaginatedResponse<T> {
|
||||
|
||||
Reference in New Issue
Block a user