feat: Add Drizzle ORM database setup, product data fetching and processing with scoring, and a diagnostic API endpoint.

This commit is contained in:
Michael committed 2026-03-10 16:04:55 +01:00
1 parent 1e5bb74344
commit 5eb3f6732e
3 files changed
+81 -84

No files matched your search

+10
View File
@@ -46,8 +46,18 @@ export function getDb() {
console.error("[DB] CRITICAL: No database connection string available!");
}
const connectionHostname = connectionString.match(/@([^:/]+)/)?.[1] || "unknown";
console.log(`[DB] Target Hostname: ${connectionHostname}`);
pool = new Pool({
connectionString,
max: 20,
idleTimeoutMillis: 30000,
connectionTimeoutMillis: 10000,
});
pool.on('error', (err) => {
console.error('[DB] Unexpected error on idle client', err);
});
currentDb = drizzle(pool, { schema });