3340fd11ca
- Initialize Prisma with SQLite and Stock model - Create database service layer with singleton client - Add API routes for stock CRUD operations - Integrate database with analyze page to persist ticker entries - Add Playwright tests for stock database functionality
15 lines
308 B
TypeScript
15 lines
308 B
TypeScript
import { PrismaClient } from "@prisma/client";
|
|
|
|
declare global {
|
|
var prisma: PrismaClient | undefined;
|
|
}
|
|
|
|
const prismaClientSingleton = () => {
|
|
return new PrismaClient();
|
|
};
|
|
|
|
export const db = global.prisma || prismaClientSingleton();
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
global.prisma = db;
|
|
} |