chore: commit all changes

This commit is contained in:
2026-02-26 13:26:18 -05:00
parent fd8edb1f21
commit 74fee52c4e
26 changed files with 4705 additions and 1108 deletions

View File

@@ -1,14 +1,14 @@
import { drizzle } from 'drizzle-orm/node-postgres';
import { Pool } from 'pg';
import { authSchema } from './schema';
import { schema } from './schema';
type AuthDrizzleDb = ReturnType<typeof createDb>;
type AppDrizzleDb = ReturnType<typeof createDb>;
declare global {
// eslint-disable-next-line no-var
var __fiscalAuthPgPool: Pool | undefined;
var __fiscalPgPool: Pool | undefined;
// eslint-disable-next-line no-var
var __fiscalAuthDrizzleDb: AuthDrizzleDb | undefined;
var __fiscalDrizzleDb: AppDrizzleDb | undefined;
}
function getConnectionString() {
@@ -21,21 +21,21 @@ function getConnectionString() {
}
export function getPool() {
if (!globalThis.__fiscalAuthPgPool) {
globalThis.__fiscalAuthPgPool = new Pool({
if (!globalThis.__fiscalPgPool) {
globalThis.__fiscalPgPool = new Pool({
connectionString: getConnectionString()
});
}
return globalThis.__fiscalAuthPgPool;
return globalThis.__fiscalPgPool;
}
function createDb() {
return drizzle(getPool(), { schema: authSchema });
return drizzle(getPool(), { schema });
}
export const db = globalThis.__fiscalAuthDrizzleDb ?? createDb();
export const db = globalThis.__fiscalDrizzleDb ?? createDb();
if (!globalThis.__fiscalAuthDrizzleDb) {
globalThis.__fiscalAuthDrizzleDb = db;
if (!globalThis.__fiscalDrizzleDb) {
globalThis.__fiscalDrizzleDb = db;
}