add event CRUD actions and recurring event expansion

- Implement full CRUD in MongoEventRepository (findById, findByUserId, findByDateRange, update, delete)
- Extend ChatService to handle create/update/delete actions with dynamic test responses
- Add recurrenceExpander utility using rrule library for RRULE parsing
- Add eventFormatters utility for German-localized week/month overviews
- Add German translations for days and months in shared Constants
- Update client ChatService to support all event actions (action, eventId, updates params)
This commit is contained in:
2026-01-04 16:15:30 +01:00
parent 9fecf94c7d
commit 77f15b6dd1
11 changed files with 577 additions and 174 deletions

View File

@@ -1,5 +1,5 @@
import { Response } from 'express';
import { SendMessageDTO, CreateEventDTO } from '@caldav/shared';
import { SendMessageDTO, CreateEventDTO, UpdateEventDTO, EventAction } from '@caldav/shared';
import { ChatService } from '../services';
import { AuthenticatedRequest } from '../middleware';
@@ -21,8 +21,21 @@ export class ChatController {
try {
const userId = req.user!.userId;
const { conversationId, messageId } = req.params;
const event: CreateEventDTO = req.body;
const response = await this.chatService.confirmEvent(userId, conversationId, messageId, event);
const { action, event, eventId, updates } = req.body as {
action: EventAction;
event?: CreateEventDTO;
eventId?: string;
updates?: UpdateEventDTO;
};
const response = await this.chatService.confirmEvent(
userId,
conversationId,
messageId,
action,
event,
eventId,
updates
);
res.json(response);
} catch (error) {
res.status(500).json({ error: 'Failed to confirm event' });