praktikum refinemend Plaetze pro Dienstelle und Pro Zeitraum

This commit is contained in:
titver968
2025-11-26 15:27:21 +01:00
parent be9228b71d
commit 89bf0298ce
40 changed files with 2932 additions and 1247 deletions

View File

@@ -1,10 +1,17 @@
import { PrismaClient } from '@prisma/client';
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
const prisma = new PrismaClient();
let prismaPromise: Promise<any> | null = null;
async function getPrismaClient() {
if (!prismaPromise) {
prismaPromise = import('@prisma/client').then(({ PrismaClient }) => new PrismaClient());
}
return prismaPromise;
}
export const GET: RequestHandler = async () => {
const prisma = await getPrismaClient(); // Hier Prisma Client holen
const dienststellen = await prisma.dienststelle.findMany({ orderBy: { name: 'asc' } });
return json(dienststellen);
};