Files
calchat/apps/server/src/services/interfaces/ChatRepository.ts
Linus Waldowsky 1092ff2648 refactor: improve AI event handling and conflict display in chat
- AI fetches events on-demand via callbacks for better efficiency
- Add conflict detection with warning display when proposing overlapping events
- Improve event search and display in chat interface
- Load full chat history for display while limiting AI context
2026-02-02 22:44:08 +01:00

48 lines
1.2 KiB
TypeScript

import {
ChatMessage,
Conversation,
CreateMessageDTO,
CreateEventDTO,
GetMessagesOptions,
UpdateMessageDTO,
ConflictingEvent,
} from "@calchat/shared";
export interface ChatRepository {
// Conversations
getConversationsByUser(userId: string): Promise<Conversation[]>;
getConversationById(conversationId: string): Promise<Conversation | null>;
createConversation(userId: string): Promise<Conversation>;
// Messages (cursor-based pagination)
getMessages(
conversationId: string,
options?: GetMessagesOptions,
): Promise<ChatMessage[]>;
createMessage(
conversationId: string,
message: CreateMessageDTO,
): Promise<ChatMessage>;
updateMessage(
messageId: string,
updates: UpdateMessageDTO,
): Promise<ChatMessage | null>;
updateProposalResponse(
messageId: string,
proposalId: string,
respondedAction: "confirm" | "reject",
): Promise<ChatMessage | null>;
updateProposalEvent(
messageId: string,
proposalId: string,
event: CreateEventDTO,
conflictingEvents?: ConflictingEvent[],
): Promise<ChatMessage | null>;
getMessageById(messageId: string): Promise<ChatMessage | null>;
}