sche.prisma und anmeldung

This commit is contained in:
titver968
2025-06-17 11:14:34 +02:00
parent 0bd4d7be96
commit beac2582ef
6 changed files with 109 additions and 11 deletions

View File

@@ -6,7 +6,9 @@ import path from 'path';
const prisma = new PrismaClient();
function checkAuth(cookies: any) {
import type { Cookies } from '@sveltejs/kit';
function checkAuth(cookies: Cookies) {
return cookies.get('admin_session') === 'true';
}
@@ -44,7 +46,10 @@ export const DELETE: RequestHandler = async ({ cookies, url }) => {
try {
await fs.unlink(filePath);
} catch (err) {
console.warn(`Datei konnte nicht gelöscht werden: ${filePath}`, err.message);
console.warn(
`Datei konnte nicht gelöscht werden: ${filePath}`,
err instanceof Error ? err.message : String(err)
);
// Fehler ignorieren, Datei evtl. manuell entfernt
}
}
@@ -61,4 +66,5 @@ export const DELETE: RequestHandler = async ({ cookies, url }) => {
console.error('Fehler beim Löschen der Anmeldung:', error);
return json({ error: 'Löschen fehlgeschlagen' }, { status: 500 });
}
};
};

View File

@@ -54,7 +54,8 @@ export async function POST({ request }) {
wunsch3Id: parseInt(get('wunsch3Id')),
pdfs: {
create: gespeichertePfade.map((pfad) => ({ pfad }))
}
},
zugewiesenId: null
}
});