mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-10 16:49:41 +00:00
add googleSheet to db model
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
|||||||
UserFields,
|
UserFields,
|
||||||
Alias,
|
Alias,
|
||||||
Settings,
|
Settings,
|
||||||
|
GoogleSheet,
|
||||||
} from 'ontime-types';
|
} from 'ontime-types';
|
||||||
|
|
||||||
import { data, db } from '../../modules/loadDb.js';
|
import { data, db } from '../../modules/loadDb.js';
|
||||||
@@ -58,6 +59,15 @@ export class DataProvider {
|
|||||||
await this.persist();
|
await this.persist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getGoogleSheet() {
|
||||||
|
return data.googleSheet;
|
||||||
|
}
|
||||||
|
|
||||||
|
static async setGoogleSheet(newData: GoogleSheet) {
|
||||||
|
data.googleSheet = { ...newData };
|
||||||
|
await this.persist();
|
||||||
|
}
|
||||||
|
|
||||||
static getOsc() {
|
static getOsc() {
|
||||||
return data.osc;
|
return data.osc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ import { DatabaseModel } from 'ontime-types';
|
|||||||
* @param {object} newData
|
* @param {object} newData
|
||||||
*/
|
*/
|
||||||
export function safeMerge(existing: DatabaseModel, newData: Partial<DatabaseModel>) {
|
export function safeMerge(existing: DatabaseModel, newData: Partial<DatabaseModel>) {
|
||||||
const { rundown, project, settings, viewSettings, osc, aliases, userFields } = newData || {};
|
const { rundown, project, settings, googleSheet, viewSettings, osc, aliases, userFields } = newData || {};
|
||||||
return {
|
return {
|
||||||
...existing,
|
...existing,
|
||||||
rundown: rundown ?? existing.rundown,
|
rundown: rundown ?? existing.rundown,
|
||||||
project: { ...existing.project, ...project },
|
project: { ...existing.project, ...project },
|
||||||
settings: { ...existing.settings, ...settings },
|
settings: { ...existing.settings, ...settings },
|
||||||
|
googleSheet: { ...existing.googleSheet, ...googleSheet },
|
||||||
viewSettings: { ...existing.viewSettings, ...viewSettings },
|
viewSettings: { ...existing.viewSettings, ...viewSettings },
|
||||||
aliases: aliases ?? existing.aliases,
|
aliases: aliases ?? existing.aliases,
|
||||||
userFields: {
|
userFields: {
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ export const dbModel: DatabaseModel = {
|
|||||||
timeFormat: '24',
|
timeFormat: '24',
|
||||||
language: 'en',
|
language: 'en',
|
||||||
},
|
},
|
||||||
|
googleSheet: {
|
||||||
|
worksheet: '',
|
||||||
|
id: '',
|
||||||
|
},
|
||||||
viewSettings: {
|
viewSettings: {
|
||||||
overrideStyles: false,
|
overrideStyles: false,
|
||||||
normalColor: '#ffffffcc',
|
normalColor: '#ffffffcc',
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { OSCSettings } from './core/OscSettings.type.js';
|
|||||||
import { Settings } from './core/Settings.type.js';
|
import { Settings } from './core/Settings.type.js';
|
||||||
import { UserFields } from './core/UserFields.type.js';
|
import { UserFields } from './core/UserFields.type.js';
|
||||||
import { ViewSettings } from './core/Views.type.js';
|
import { ViewSettings } from './core/Views.type.js';
|
||||||
|
import { GoogleSheet } from '../index.js';
|
||||||
|
|
||||||
export type DatabaseModel = {
|
export type DatabaseModel = {
|
||||||
rundown: OntimeRundown;
|
rundown: OntimeRundown;
|
||||||
@@ -13,5 +14,6 @@ export type DatabaseModel = {
|
|||||||
viewSettings: ViewSettings;
|
viewSettings: ViewSettings;
|
||||||
aliases: Alias[];
|
aliases: Alias[];
|
||||||
userFields: UserFields;
|
userFields: UserFields;
|
||||||
|
googleSheet: GoogleSheet;
|
||||||
osc: OSCSettings;
|
osc: OSCSettings;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export type GoogleSheet = {
|
||||||
|
worksheet: string;
|
||||||
|
id: string;
|
||||||
|
};
|
||||||
@@ -33,6 +33,9 @@ export type { OSCSettings, OscSubscription, OscSubscriptionOptions } from './def
|
|||||||
|
|
||||||
// ---> HTTP
|
// ---> HTTP
|
||||||
|
|
||||||
|
// ---> Google Sheet
|
||||||
|
export type { GoogleSheet } from './definitions/core/GoogleSheet.type.js';
|
||||||
|
|
||||||
// SERVER RESPONSES
|
// SERVER RESPONSES
|
||||||
export type { NetworkInterface, GetInfo } from './api/ontime-controller/BackendResponse.type.js';
|
export type { NetworkInterface, GetInfo } from './api/ontime-controller/BackendResponse.type.js';
|
||||||
export type { GetRundownCached } from './api/rundown-controller/BackendResponse.type.js';
|
export type { GetRundownCached } from './api/rundown-controller/BackendResponse.type.js';
|
||||||
|
|||||||
Reference in New Issue
Block a user