import pg from "pg";
import { env } from "../config/env.js";

export const pool = new pg.Pool({
  connectionString: env.databaseUrl
});

export async function checkDatabase() {
  const result = await pool.query<{ now: Date }>("select now() as now");
  return result.rows[0];
}

export async function closeDatabase() {
  await pool.end();
}
