Gateway: - Remove dead barrels (ai-moderation/index, attachment-upload/index, message-capture/index) — all consumers import files directly - Remove orphaned schema/ split dir (analytics/cache/messages/meta) — schema.ts is monolithic - Merge duplicate config singleton: delete shared/config/config.ts, point all 44 imports at shared/config/index Backend: - Remove dead commandHelper.ts (voice-era fallback), ws/index.ts barrel, health.schema.ts, moderationMetrics.ts, analysis.schema.ts (0 importers; metrics/handlers route directly) Frontend: - Remove orphaned CategoryDrilldown/CoverageTiles/TopicTrends, primitives/slot, use-mobile, use-mounted - Remove unused charts donut/sparkline (TopicTrends was only consumer) Kept (verified active): shared/database/index.ts facade (11 importers), hooks/index + lib/api/index barrels (10 importers), orpc/ws.ts, charts/index.ts barrel. Verified: tsc + biome + vitest per service (backend e2e 3 failures pre-existing on main); frontend next build 8 routes.
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import {
|
|
closeDatabase as sharedCloseDb,
|
|
executeAll as sharedExecAll,
|
|
executeGet as sharedExecGet,
|
|
getDatabase as sharedGetDb,
|
|
initializeDatabase as sharedInit,
|
|
withDatabaseClient as sharedWithClient,
|
|
} from "@/shared/database/init";
|
|
import { createChildLogger } from "@/shared/logger/index";
|
|
import { config } from "../../shared/config/index.js";
|
|
import * as schema from "./schema.js";
|
|
|
|
const logger = createChildLogger("drizzle");
|
|
|
|
const dbConfig = {
|
|
DATABASE_URL: config.DATABASE_URL,
|
|
POSTGRES_HOST: config.POSTGRES_HOST,
|
|
POSTGRES_PORT: config.POSTGRES_PORT,
|
|
POSTGRES_USER: config.POSTGRES_USER,
|
|
POSTGRES_PASSWORD: config.POSTGRES_PASSWORD,
|
|
POSTGRES_DB: config.POSTGRES_DB,
|
|
POSTGRES_POOL_MIN: config.POSTGRES_POOL_MIN,
|
|
POSTGRES_POOL_MAX: config.POSTGRES_POOL_MAX,
|
|
};
|
|
|
|
export async function initializeDatabase() {
|
|
logger.info("Initializing database");
|
|
return sharedInit(dbConfig, schema);
|
|
}
|
|
|
|
export function getDatabase() {
|
|
return sharedGetDb();
|
|
}
|
|
|
|
export const closeDatabase = sharedCloseDb;
|
|
export const executeAll = sharedExecAll;
|
|
export const executeGet = sharedExecGet;
|
|
export const withDatabaseClient = sharedWithClient;
|