69 lines
2.4 KiB
TypeScript
69 lines
2.4 KiB
TypeScript
import { IEventBus, ICalendarEvent } from '../types/CalendarTypes';
|
|
import { Configuration } from '../configurations/CalendarConfig';
|
|
import { DateService } from '../utils/DateService';
|
|
import { IEventRepository } from '../repositories/IEventRepository';
|
|
/**
|
|
* EventManager - Event lifecycle and CRUD operations
|
|
* Delegates all data operations to IEventRepository
|
|
* No longer maintains in-memory cache - repository is single source of truth
|
|
*/
|
|
export declare class EventManager {
|
|
private eventBus;
|
|
private dateService;
|
|
private config;
|
|
private repository;
|
|
constructor(eventBus: IEventBus, dateService: DateService, config: Configuration, repository: IEventRepository);
|
|
/**
|
|
* Load event data from repository
|
|
* No longer caches - delegates to repository
|
|
*/
|
|
loadData(): Promise<void>;
|
|
/**
|
|
* Get all events from repository
|
|
*/
|
|
getEvents(copy?: boolean): Promise<ICalendarEvent[]>;
|
|
/**
|
|
* Get event by ID from repository
|
|
*/
|
|
getEventById(id: string): Promise<ICalendarEvent | undefined>;
|
|
/**
|
|
* Get event by ID and return event info for navigation
|
|
* @param id Event ID to find
|
|
* @returns Event with navigation info or null if not found
|
|
*/
|
|
getEventForNavigation(id: string): Promise<{
|
|
event: ICalendarEvent;
|
|
eventDate: Date;
|
|
} | null>;
|
|
/**
|
|
* Navigate to specific event by ID
|
|
* Emits navigation events for other managers to handle
|
|
* @param eventId Event ID to navigate to
|
|
* @returns true if event found and navigation initiated, false otherwise
|
|
*/
|
|
navigateToEvent(eventId: string): Promise<boolean>;
|
|
/**
|
|
* Get events that overlap with a given time period
|
|
*/
|
|
getEventsForPeriod(startDate: Date, endDate: Date): Promise<ICalendarEvent[]>;
|
|
/**
|
|
* Create a new event and add it to the calendar
|
|
* Delegates to repository with source='local'
|
|
*/
|
|
addEvent(event: Omit<ICalendarEvent, 'id'>): Promise<ICalendarEvent>;
|
|
/**
|
|
* Update an existing event
|
|
* Delegates to repository with source='local'
|
|
*/
|
|
updateEvent(id: string, updates: Partial<ICalendarEvent>): Promise<ICalendarEvent | null>;
|
|
/**
|
|
* Delete an event
|
|
* Delegates to repository with source='local'
|
|
*/
|
|
deleteEvent(id: string): Promise<boolean>;
|
|
/**
|
|
* Handle remote update from SignalR
|
|
* Delegates to repository with source='remote'
|
|
*/
|
|
handleRemoteUpdate(event: ICalendarEvent): Promise<void>;
|
|
}
|