update
This commit is contained in:
@@ -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>
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user