style: clean up code formatting and remove trailing whitespace

refactor: reorganize imports and fix type imports
This commit is contained in:
Evandro Fonseca Junior committed 2025-11-11 03:08:36 -03:00
1 parent d3704602fd
commit 47c04de6fe
232 files changed
+7140 -4798

No files matched your search

+11 -8
View File
@@ -3,15 +3,15 @@
* Executa um health check e tenta uma query simples
*/
import { resolve } from "node:path";
// Carregar variáveis de ambiente
import { config } from "dotenv";
import { resolve } from "path";
// Tentar carregar .env.local primeiro, depois .env
config({ path: resolve(process.cwd(), ".env.local") });
config({ path: resolve(process.cwd(), ".env") });
import { healthCheck, query, closePool } from "./index";
import { closePool, healthCheck, query } from "./index";
async function testConnection() {
console.log("🔍 Testando conexão com PostgreSQL...\n");
@@ -27,7 +27,9 @@ async function testConnection() {
}
console.log("✅ Variável PG_DB encontrada");
console.log(` Host: ${process.env.PG_DB.split("@")[1]?.split("/")[0] || "não detectado"}\n`);
console.log(
` Host: ${process.env.PG_DB.split("@")[1]?.split("/")[0] || "não detectado"}\n`,
);
try {
// Health check
@@ -44,9 +46,11 @@ async function testConnection() {
// Query de teste
console.log("📊 Executando query de teste...");
const result = await query("SELECT version(), NOW() as current_time");
console.log("✅ Query executada com sucesso");
console.log(` PostgreSQL Version: ${result.rows[0]?.version?.split(" ")[0] || "N/A"}`);
console.log(
` PostgreSQL Version: ${result.rows[0]?.version?.split(" ")[0] || "N/A"}`,
);
console.log(` Current Time: ${result.rows[0]?.current_time || "N/A"}\n`);
// Verificar se as tabelas existem
@@ -76,14 +80,14 @@ async function testConnection() {
} catch (error) {
console.error("❌ Erro ao conectar com PostgreSQL:");
console.error(error instanceof Error ? error.message : String(error));
if (error instanceof Error && error.message.includes("timeout")) {
console.log("\n💡 Verifique:");
console.log(" - O servidor PostgreSQL está acessível?");
console.log(" - A URL de conexão está correta?");
console.log(" - O firewall permite conexões?");
}
if (error instanceof Error && error.message.includes("authentication")) {
console.log("\n💡 Verifique:");
console.log(" - Usuário e senha estão corretos?");
@@ -96,4 +100,3 @@ async function testConnection() {
}
testConnection();