Files
core/src/features/auth/dashboard.server.js
T

23 lines
720 B
JavaScript

/**
* 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);