mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-26 01:19:11 +00:00
chore: create import map utilities
This commit is contained in:
@@ -23,3 +23,10 @@ export { deepmerge } from './src/externals/deepmerge.js';
|
|||||||
|
|
||||||
// generic utilities
|
// generic utilities
|
||||||
export { isNumeric } from './src/types/types.js';
|
export { isNumeric } from './src/types/types.js';
|
||||||
|
// feature business logic - excel import
|
||||||
|
export {
|
||||||
|
type ExcelImportMap,
|
||||||
|
type ExcelImportOptions,
|
||||||
|
defaultExcelImportMap,
|
||||||
|
isExcelImportMap,
|
||||||
|
} from './src/feature/excel-import/excelImport.js';
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
export type ExcelImportOptions = keyof typeof defaultExcelImportMap;
|
||||||
|
export type ExcelImportMap = typeof defaultExcelImportMap;
|
||||||
|
|
||||||
|
export const defaultExcelImportMap = {
|
||||||
|
worksheet: 'event schedule',
|
||||||
|
projectName: 'project name',
|
||||||
|
projectDescription: 'project descriptotion',
|
||||||
|
publicUrl: 'public url',
|
||||||
|
publicInfo: 'public info',
|
||||||
|
backstageUrl: 'backstage url',
|
||||||
|
backstageInfo: 'backstage info',
|
||||||
|
timeStart: 'time start',
|
||||||
|
timeEnd: 'time end',
|
||||||
|
duration: 'duration',
|
||||||
|
cue: 'cue',
|
||||||
|
title: 'event title',
|
||||||
|
presenter: 'presenter name',
|
||||||
|
subtitle: 'event subtitle',
|
||||||
|
isPublic: 'is public? (x)',
|
||||||
|
skip: 'skip? (x)',
|
||||||
|
note: 'notes',
|
||||||
|
colour: 'colour',
|
||||||
|
endAction: 'end action',
|
||||||
|
timerType: 'timer type',
|
||||||
|
user0: 'user0',
|
||||||
|
user1: 'user1',
|
||||||
|
user2: 'user2',
|
||||||
|
user3: 'user3',
|
||||||
|
user4: 'user4',
|
||||||
|
user5: 'user5',
|
||||||
|
user6: 'user6',
|
||||||
|
user7: 'user7',
|
||||||
|
user8: 'user8',
|
||||||
|
user9: 'user9',
|
||||||
|
};
|
||||||
|
|
||||||
|
export function isExcelImportMap(obj: unknown): obj is ExcelImportMap {
|
||||||
|
if (typeof obj !== 'object' || obj === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const keys = Object.keys(obj);
|
||||||
|
return keys.every((key) => Object.hasOwn(defaultExcelImportMap, key));
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user