Files
ProxmoxVE-Local/src/server/db.ts
CanbiZ 48cf86a449 Refactor nullish checks and add type safety
Replaces many uses of logical OR (||) with nullish coalescing (??) for more accurate handling of undefined/null values. Adds explicit type annotations and interfaces to improve type safety, especially in API routes and server-side code. Updates SSH connection test handling and config parsing in installedScripts router for better reliability. Minor fixes to deduplication logic, cookie handling, and error reporting.
2025-11-28 12:10:15 +01:00

12 lines
326 B
TypeScript

import { PrismaClient } from '@prisma/client';
const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined;
};
export const prisma: PrismaClient = globalForPrisma.prisma ?? new PrismaClient({
log: ['warn', 'error']
});
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;