This commit is contained in:
Matthias Hochmeister
2026-03-16 15:01:09 +01:00
parent 3c72fe627f
commit f3ad989a9e
28 changed files with 794 additions and 52 deletions

View File

@@ -118,6 +118,39 @@ class EventsController {
}
};
// -------------------------------------------------------------------------
// GET /api/events/conflicts?from=<ISO>&to=<ISO>&excludeId=<uuid>
// -------------------------------------------------------------------------
checkConflicts = async (req: Request, res: Response): Promise<void> => {
try {
const fromStr = req.query.from as string | undefined;
const toStr = req.query.to as string | undefined;
const excludeId = req.query.excludeId as string | undefined;
if (!fromStr || !toStr) {
res.status(400).json({
success: false,
message: 'Query-Parameter "from" und "to" sind erforderlich (ISO-8601)',
});
return;
}
const from = new Date(fromStr);
const to = new Date(toStr);
if (isNaN(from.getTime()) || isNaN(to.getTime())) {
res.status(400).json({ success: false, message: 'Ungültiges Datumsformat' });
return;
}
const data = await eventsService.checkConflicts(from, to, excludeId);
res.json({ success: true, data });
} catch (error) {
logger.error('checkConflicts error', { error });
res.status(500).json({ success: false, message: 'Fehler bei der Konfliktprüfung' });
}
};
// -------------------------------------------------------------------------
// GET /api/events/calendar?from=<ISO>&to=<ISO>
// -------------------------------------------------------------------------