Files
google-labs-jules[bot] 5377f239a5 Refactor core services for multi-rundown support
This commit introduces foundational changes to enable handling multiple rundowns within a single project.

Key changes:

- `rundown.dao.ts`:
    - Replaced single global rundown cache with Map-based caches for rundowns, metadata, and custom field usage, keyed by RundownId.
    - Updated `init`, getters, and transaction logic to operate on specific RundownIds.
    - Added `removeRundownFromCache`.
    - Basic unit tests for DAO operations implemented.

- `ProjectService.ts`:
    - `loadProject` now initializes all rundowns from a project file into the DAO.
    - `patchCurrentProject` updated to sync multiple rundowns with the DAO (add/update/remove from cache).
    - Added new CRUD methods: `getAvailableRundownsInCurrentProject`, `createNewRundownInCurrentProject`, `deleteRundownFromCurrentProject`, `updateRundownMetadataInCurrentProject`.

- `RuntimeService.ts`:
    - Introduced `activeRundownId` state.
    - Implemented `setActiveRundown`, `clearActiveRundown`, `getActiveRundownId`.
    - DAO calls within service now use `activeRundownId`.
    - `notifyOfChangedEvents` now filters by active rundown.
    - `RestorePoint` type and save/resume logic updated to include `rundownId`.
    - Enhanced state reset in `runtimeState.ts` and `RuntimeService` for rundown context switching.

- `AppStateService.ts`:
    - Extended `AppState` to persist `lastActiveRundowns` (map of projectFileName to last active RundownId).
    - Added methods to manage this persisted preference.

- API Layer (Conceptual Outline):
    - Project loading to make all rundowns available and activate last active.
    - New CRUD APIs for rundowns within a project.
    - New API for runtime activation (`/runtime/activate_rundown`).
    - Existing runtime APIs to use activated context.
    - Editing APIs to explicitly target `rundownId`.

Further work will involve implementing the API layer changes and comprehensively updating/writing tests across the application to align with this new architecture.
2025-07-11 13:30:46 +00:00
..
2025-05-13 21:24:14 +02:00