diff --git a/backend/src/routes/storage.ts b/backend/src/routes/storage.ts index 9804f3a..18159f9 100644 --- a/backend/src/routes/storage.ts +++ b/backend/src/routes/storage.ts @@ -1,6 +1,7 @@ import { Router, Response } from 'express'; import { PrismaClient, StorageLocation, TrashType } from '@prisma/client'; import { AuthedRequest, requireAuth, requireRole } from '../middleware/auth'; +import { runTrashCalendarSyncJob } from '../jobs/trashCalendarSyncJob'; const prisma = new PrismaClient(); @@ -158,3 +159,20 @@ storageRouter.delete( } }, ); + +// Manuelles Nachladen der amtlichen Nackenheim-Termine (dieselbe Quelle wie +// der tägliche Host-Cron, siehe jobs/trashCalendarSyncJob.ts) — für den Fall, +// dass der Vermieter nicht bis zum nächsten automatischen Lauf warten will. +storageRouter.post( + '/trash-schedule/sync', + requireAuth, + requireRole('LANDLORD', 'ADMIN'), + async (_req: AuthedRequest, res: Response) => { + try { + const result = await runTrashCalendarSyncJob(); + res.status(200).json(result); + } catch (err) { + res.status(502).json({ error: err instanceof Error ? err.message : 'Sync fehlgeschlagen' }); + } + }, +); diff --git a/web-dashboard/index.html b/web-dashboard/index.html index bfaef75..b64d954 100644 --- a/web-dashboard/index.html +++ b/web-dashboard/index.html @@ -4,6 +4,8 @@ WG Nackenheim — Vermieter-Cockpit + +