- Add controllers (Auth, Chat, Event) with placeholder implementations - Add services (Auth, Chat, Event) with business logic interfaces - Add repositories with MongoDB/Mongoose models (User, Event, Chat) - Add middleware for JWT authentication - Add Claude AI adapter implementing AIProvider interface - Add utility modules for JWT and password handling - Add shared types and DTOs for User, CalendarEvent, ChatMessage - Configure routes with proper endpoint structure - Update app.ts with dependency injection setup - Add required dependencies: mongoose, bcrypt, jsonwebtoken, @anthropic-ai/sdk
165 lines
3.2 KiB
Plaintext
165 lines
3.2 KiB
Plaintext
@startuml "Backend Klassendiagramm"
|
|
|
|
skinparam packageStyle rectangle
|
|
skinparam classAttributeIconSize 0
|
|
skinparam classFontSize 11
|
|
skinparam defaultFontSize 10
|
|
|
|
top to bottom direction
|
|
|
|
title Backend Architektur - Klassendiagramm
|
|
|
|
package "Controller Layer" #ADD8E6 {
|
|
class AuthController {
|
|
' +login()
|
|
' +register()
|
|
' +refresh()
|
|
' +logout()
|
|
}
|
|
|
|
class ChatController {
|
|
' +sendMessage()
|
|
' +confirmEvent()
|
|
' +rejectEvent()
|
|
' +getConversations()
|
|
}
|
|
|
|
class EventController {
|
|
' +create()
|
|
' +getAll()
|
|
' +getByDateRange()
|
|
' +update()
|
|
' +delete()
|
|
}
|
|
|
|
class AuthMiddleware {
|
|
' +authenticate()
|
|
}
|
|
}
|
|
|
|
package "Service Layer" #90EE90 {
|
|
package "Data Access Interfaces" {
|
|
interface AIProvider {
|
|
' +processMessage()
|
|
}
|
|
|
|
interface UserRepository {
|
|
' +findById()
|
|
' +findByEmail()
|
|
' +create()
|
|
}
|
|
|
|
interface EventRepository {
|
|
' +findById()
|
|
' +findByUserId()
|
|
' +findByDateRange()
|
|
' +create()
|
|
' +update()
|
|
' +delete()
|
|
}
|
|
|
|
interface ChatRepository {
|
|
' +getHistory()
|
|
' +create()
|
|
}
|
|
}
|
|
|
|
class AuthService {
|
|
' -userRepo: UserRepository
|
|
' +login()
|
|
' +register()
|
|
}
|
|
|
|
class ChatService {
|
|
' -chatRepo: ChatRepository
|
|
' -eventRepo: EventRepository
|
|
' -aiProvider: AIProvider
|
|
' +processMessage()
|
|
' +confirmEvent()
|
|
}
|
|
|
|
class EventService {
|
|
' -eventRepo: EventRepository
|
|
' +create()
|
|
' +getByDateRange()
|
|
' +update()
|
|
' +delete()
|
|
}
|
|
}
|
|
|
|
package "AI Layer" #FFA07A {
|
|
class ClaudeAdapter implements AIProvider {
|
|
' -apiKey: string
|
|
' +processMessage()
|
|
}
|
|
}
|
|
|
|
package "Data Access Implementations" #FFD700 {
|
|
class MongoUserRepository implements UserRepository {
|
|
' -model: UserModel
|
|
}
|
|
|
|
class MongoEventRepository implements EventRepository {
|
|
' -model: EventModel
|
|
}
|
|
|
|
class MongoChatRepository implements ChatRepository {
|
|
' -model: ChatModel
|
|
}
|
|
}
|
|
|
|
package "Models" #D3D3D3 {
|
|
class User <<Entity>> {
|
|
' +id: string
|
|
' +email: string
|
|
' +displayName: string
|
|
}
|
|
|
|
class CalendarEvent <<Entity>> {
|
|
' +id: string
|
|
' +userId: string
|
|
' +title: string
|
|
' +startTime: Date
|
|
' +endTime: Date
|
|
' +note?: string
|
|
}
|
|
|
|
class ChatMessage <<Entity>> {
|
|
' +id: string
|
|
' +sender: string
|
|
' +content: string
|
|
' +proposedEvent?: ProposedEvent
|
|
}
|
|
}
|
|
|
|
package "Utils" #DDA0DD {
|
|
class JWT {
|
|
' +signToken()
|
|
' +verifyToken()
|
|
}
|
|
|
|
class Password {
|
|
' +hash()
|
|
' +compare()
|
|
}
|
|
}
|
|
|
|
' Controller -> Service
|
|
AuthController --> AuthService
|
|
ChatController --> ChatService
|
|
EventController --> EventService
|
|
AuthMiddleware --> JWT
|
|
|
|
' Service -> Interfaces (intern)
|
|
AuthService --> UserRepository
|
|
ChatService --> ChatRepository
|
|
ChatService --> EventRepository
|
|
ChatService --> AIProvider
|
|
EventService --> EventRepository
|
|
|
|
' Auth uses Utils
|
|
AuthService --> JWT
|
|
AuthService --> Password
|
|
|
|
@enduml
|