mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-04 23:18:01 +00:00
5377f239a5
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.