mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 18:03:47 +00:00
74418ce17e
* add test for linking start time in excel import * link ids * add link to UI * ensure times with cachedRundown --------- Co-authored-by: Carlos Valente <carlosvalente@pm.me>
37 lines
951 B
TypeScript
37 lines
951 B
TypeScript
export type ImportOptions = keyof typeof defaultImportMap | 'custom';
|
|
export type ImportCustom = Record<string, string>;
|
|
export type ImportMap = typeof defaultImportMap & { custom: ImportCustom };
|
|
|
|
// Record of ontime name and import name
|
|
export const defaultImportMap = {
|
|
worksheet: 'event schedule',
|
|
timeStart: 'time start',
|
|
linkStart: 'link start',
|
|
timeEnd: 'time end',
|
|
duration: 'duration',
|
|
cue: 'cue',
|
|
title: 'title',
|
|
isPublic: 'public',
|
|
skip: 'skip',
|
|
note: 'notes',
|
|
colour: 'colour',
|
|
endAction: 'end action',
|
|
timerType: 'timer type',
|
|
timeWarning: 'warning time',
|
|
timeDanger: 'danger time',
|
|
custom: {},
|
|
};
|
|
|
|
/**
|
|
* Validates whether an object is an Import Map
|
|
* @param obj
|
|
*/
|
|
export function isImportMap(obj: unknown): obj is ImportMap {
|
|
if (typeof obj !== 'object' || obj === null) {
|
|
return false;
|
|
}
|
|
|
|
const keys = Object.keys(defaultImportMap);
|
|
return keys.every((key) => Object.hasOwn(obj, key));
|
|
}
|