mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-19 06:04:05 +00:00
feat: allow user to duplicate a rundown
This commit is contained in:
committed by
Carlos Valente
parent
17f80baf48
commit
32bf0f53f6
@@ -34,6 +34,7 @@ import {
|
||||
milestone as milestoneDef,
|
||||
} from '../../models/eventsDefinition.js';
|
||||
import { makeString } from '../../utils/parserUtils.js';
|
||||
|
||||
import { RundownMetadata } from './rundown.types.js';
|
||||
|
||||
type CompleteEntry<T> =
|
||||
@@ -517,3 +518,18 @@ export function normalisedToRundownArray(rundowns: ProjectRundowns): ProjectRund
|
||||
return { id, numEntries: flatOrder.length, title, revision };
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Duplicates an existing rundown ensuring all IDs are unique
|
||||
*/
|
||||
export function duplicateRundown(rundown: Rundown, newTitle: string): Rundown {
|
||||
const newRundownId = generateId();
|
||||
|
||||
const newRundown = structuredClone(rundown);
|
||||
newRundown.id = newRundownId;
|
||||
newRundown.title = newTitle;
|
||||
newRundown.revision = 0;
|
||||
|
||||
return newRundown;
|
||||
}
|
||||
Reference in New Issue
Block a user