refactor(admin): replace static dashboard stats with dynamic widget registry
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user