mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
use global for prisma
This commit is contained in:
16
db/index.ts
16
db/index.ts
@@ -1,11 +1,23 @@
|
||||
import { BookingStatus, Booking, PrismaClient, Prisma } from '@prisma/client'
|
||||
|
||||
const prisma = new PrismaClient()
|
||||
|
||||
import { getBookedDays as calendarGetBookedDays } from '../lib/googlecalendar'
|
||||
import { uniqueFilter } from '../helpers/array'
|
||||
import { dateFormatBackend, getDays, nowInTz } from '../helpers/date'
|
||||
|
||||
declare global {
|
||||
// allow global `var` declarations
|
||||
// eslint-disable-next-line no-var
|
||||
var prisma: PrismaClient | undefined
|
||||
}
|
||||
|
||||
export const prisma =
|
||||
global.prisma ||
|
||||
new PrismaClient({
|
||||
log: ['query'],
|
||||
})
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') global.prisma = prisma
|
||||
|
||||
export async function getBookedDays(
|
||||
uuidsToIngore?: string[]
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user