Add comprehensive demo data loading logic and .env.demo configuration

- Implemented `load_demo_data` to populate organizations, users, and relationships from `demo_data.json`.
- Refactored database initialization to handle demo-specific passwords and multi-entity creation in demo mode.
- Added `demo_data.json` with sample organizations and users for better demo showcase.
- Introduced `.env.demo` to simplify environment setup for demo scenarios.
- Updated `.gitignore` to include `.env.demo` while keeping other `.env` files excluded.
This commit is contained in:
Felipe Cardoso
2025-11-21 08:39:07 +01:00
parent 9b6356b0db
commit 8c83e2a699
5 changed files with 205 additions and 23 deletions

View File

@@ -0,0 +1,45 @@
import { apiClient } from './client';
import type { Options } from './generated/sdk.gen';
export interface UserGrowthData {
date: string;
totalUsers: number;
activeUsers: number;
}
export interface OrgDistributionData {
name: string;
value: number;
}
export interface UserStatusData {
name: string;
value: number;
}
export interface AdminStatsResponse {
user_growth: UserGrowthData[];
organization_distribution: OrgDistributionData[];
user_status: UserStatusData[];
}
/**
* Admin: Get Dashboard Stats
*
* Get aggregated statistics for the admin dashboard (admin only)
*/
export const getAdminStats = <ThrowOnError extends boolean = false>(
options?: Options<any, ThrowOnError>
) => {
return (options?.client ?? apiClient).get<AdminStatsResponse, any, ThrowOnError>({
responseType: 'json',
security: [
{
scheme: 'bearer',
type: 'http',
},
],
url: '/api/v1/admin/stats',
...options,
});
};