addition of new dashboard
This commit is contained in:
12
backend/modules/dashboard/account.js
Normal file
12
backend/modules/dashboard/account.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { getPool } from "../../db/index.js";
|
||||
|
||||
// Legacy `auth` table only; the user-managed api_key store is counted separately.
|
||||
export async function countApiKeys(userId) {
|
||||
const client = await getPool();
|
||||
try {
|
||||
const r = await client.query(`SELECT COUNT(*)::int AS n FROM auth WHERE user_id = $1`, [userId]);
|
||||
return r.rows[0].n;
|
||||
} finally {
|
||||
await client.release();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user