* yarn * yarn update * added Mardown style formatting with sanitized inputs * Revert "yarn" This reverts commit 46eb3595cf687504c6783315749b3124936080b9. * Revert "yarn" This reverts commit 46eb3595cf687504c6783315749b3124936080b9. * Revert "yarn update" This reverts commit f4600d83a67b930c6dd72e292827578856ca5428. * Revert "yarn" This reverts commit 46eb3595cf687504c6783315749b3124936080b9. * Revert "yarn update" This reverts commit f4600d83a67b930c6dd72e292827578856ca5428. * Revert "Revert "yarn update"" This reverts commit 8ccab5ee237fb228115229f3c89cf4b848bc9449. * Revert "Revert "yarn"" This reverts commit 78a755eb39cb518eb0526272a3c11882c48004de. * yarn.lock removed * Parses using prisma middleware * Reverting changes * Fixes hydration warning * Fixes Dom warnings * Update yarn.lock Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: zomars <zomars@me.com>
29 lines
883 B
TypeScript
29 lines
883 B
TypeScript
import { Prisma, PrismaClient } from "@prisma/client";
|
|
|
|
import { bookingReferenceMiddleware, eventTypeDescriptionParseAndSanitizeMiddleware } from "./middleware";
|
|
|
|
declare global {
|
|
// eslint-disable-next-line no-var
|
|
var prisma: PrismaClient | undefined;
|
|
}
|
|
|
|
const prismaOptions: Prisma.PrismaClientOptions = {};
|
|
|
|
if (!!process.env.NEXT_PUBLIC_DEBUG) prismaOptions.log = ["query", "error", "warn"];
|
|
|
|
export const prisma = globalThis.prisma || new PrismaClient(prismaOptions);
|
|
|
|
export const customPrisma = (options: Prisma.PrismaClientOptions) =>
|
|
new PrismaClient({ ...prismaOptions, ...options });
|
|
|
|
if (process.env.NODE_ENV !== "production") {
|
|
globalThis.prisma = prisma;
|
|
}
|
|
// If any changed on middleware server restart is required
|
|
bookingReferenceMiddleware(prisma);
|
|
eventTypeDescriptionParseAndSanitizeMiddleware(prisma);
|
|
|
|
export default prisma;
|
|
|
|
export * from "./selects";
|