13 lines
390 B
JavaScript
13 lines
390 B
JavaScript
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();
|
|
}
|
|
}
|