refactor(admin): replace static dashboard stats with dynamic widget registry

This commit is contained in:
2026-04-15 20:43:10 -04:00
parent 371a69c499
commit 41edccc1a3
11 changed files with 198 additions and 69 deletions
+22
View File
@@ -0,0 +1,22 @@
/**
* Auth Feature — Contribution serveur au tableau de bord
*
* Ce module s'auto-enregistre auprès du registre admin en side effect.
* Dépendance correcte : auth → admin (feature → core).
*/
import { registerServerWidget } from '../admin/dashboard/registry.js';
import { query } from '@zen/core/database';
import { fail } from '@zen/core/shared/logger';
async function getDashboardData() {
try {
const result = await query(`SELECT COUNT(*) as count FROM zen_auth_users`);
return { totalUsers: parseInt(result.rows[0].count) || 0 };
} catch (error) {
fail(`Auth dashboard data error: ${error.message}`);
return { totalUsers: 0 };
}
}
registerServerWidget('auth', getDashboardData);