feat: add CalDAV synchronization with automatic sync

- Add CaldavService with tsdav/ical.js for CalDAV server communication
- Add CaldavController, CaldavRepository, and caldav routes
- Add client-side CaldavConfigService with sync(), config CRUD
- Add CalDAV settings UI with config load/save in settings screen
- Sync on login, auto-login (AuthGuard), periodic timer (calendar), and sync button
- Push single events to CalDAV on server-side create/update/delete
- Push all events to CalDAV after chat event confirmation
- Refactor ChatService to use EventService instead of direct EventRepository
- Rename CalDav/calDav to Caldav/caldav for consistent naming
- Add Radicale Docker setup for local CalDAV testing
- Update PlantUML diagrams and CLAUDE.md with CalDAV architecture
This commit is contained in:
2026-02-08 19:24:59 +01:00
parent 81221d8b70
commit 325246826a
44 changed files with 7074 additions and 126 deletions

View File

@@ -17,6 +17,9 @@ import {
} from "./repositories";
import { GPTAdapter } from "./ai";
import { logger } from "./logging";
import { MongoCaldavRepository } from "./repositories/mongo/MongoCaldavRepository";
import { CaldavService } from "./services/CaldavService";
import { CaldavController } from "./controllers/CaldavController";
const app = express();
const port = process.env.PORT || 3000;
@@ -51,6 +54,7 @@ if (process.env.NODE_ENV !== "production") {
const userRepo = new MongoUserRepository();
const eventRepo = new MongoEventRepository();
const chatRepo = new MongoChatRepository();
const caldavRepo = new MongoCaldavRepository();
// Initialize AI provider
const aiProvider = new GPTAdapter();
@@ -60,15 +64,16 @@ const authService = new AuthService(userRepo);
const eventService = new EventService(eventRepo);
const chatService = new ChatService(
chatRepo,
eventRepo,
eventService,
aiProvider,
);
const caldavService = new CaldavService(caldavRepo, eventService);
// Initialize controllers
const authController = new AuthController(authService);
const chatController = new ChatController(chatService);
const eventController = new EventController(eventService);
const chatController = new ChatController(chatService, caldavService);
const eventController = new EventController(eventService, caldavService);
const caldavController = new CaldavController(caldavService);
// Setup routes
app.use(
@@ -77,6 +82,7 @@ app.use(
authController,
chatController,
eventController,
caldavController
}),
);