mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-07-13 22:37:14 +10:00
3c222660c1
Co-authored-by: Amruth Pillai <im.amruth@gmail.com>
20 lines
531 B
TypeScript
20 lines
531 B
TypeScript
import type { E2EAccount } from "./data";
|
|
import { Pool } from "pg";
|
|
|
|
function getDatabaseUrl() {
|
|
const databaseUrl = process.env.DATABASE_URL;
|
|
if (!databaseUrl) throw new Error("DATABASE_URL is required for E2E cleanup.");
|
|
|
|
return databaseUrl;
|
|
}
|
|
|
|
export async function deleteE2EUser(account: E2EAccount) {
|
|
const pool = new Pool({ connectionString: getDatabaseUrl() });
|
|
|
|
try {
|
|
await pool.query('delete from "user" where email = $1 or username = $2', [account.email, account.username]);
|
|
} finally {
|
|
await pool.end();
|
|
}
|
|
}
|