mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 09:53:48 +00:00
parseGoogleSheet from db
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { generateId } from 'ontime-utils';
|
||||
import {
|
||||
Alias,
|
||||
GoogleSheet,
|
||||
OntimeRundown,
|
||||
OSCSettings,
|
||||
OscSubscription,
|
||||
@@ -284,3 +285,24 @@ export const parseUserFields = (data): UserFields => {
|
||||
}
|
||||
return { ...newUserFields };
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse Google Sheet portion of an entry
|
||||
* @param {object} data - data object
|
||||
* @param {boolean} enforce - whether to create a definition if one is missing
|
||||
* @returns {object} - event object data
|
||||
*/
|
||||
export const parseGoogleSheet = (data, enforce) => {
|
||||
const newSheet: GoogleSheet = {
|
||||
id: '',
|
||||
worksheet: '',
|
||||
};
|
||||
if ('googleSheet' in data) {
|
||||
console.log('Found Google Sheet definition, importing...');
|
||||
newSheet.id ??= data.googleSheet?.id;
|
||||
newSheet.worksheet ??= data.googleSheet?.worksheet;
|
||||
return newSheet;
|
||||
} else if (enforce) {
|
||||
return newSheet;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user