mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-08 17:03:53 +00:00
refactor: remove legacy service
This commit is contained in:
committed by
Carlos Valente
parent
1f71d4578c
commit
2cc434b0e9
@@ -3,10 +3,8 @@ import {
|
||||
OntimeRundown,
|
||||
ViewSettings,
|
||||
DatabaseModel,
|
||||
OSCSettings,
|
||||
Settings,
|
||||
CustomFields,
|
||||
HttpSettings,
|
||||
URLPreset,
|
||||
AutomationSettings,
|
||||
} from 'ontime-types';
|
||||
@@ -49,14 +47,10 @@ export function getDataProvider() {
|
||||
setRundown,
|
||||
getSettings,
|
||||
setSettings,
|
||||
getOsc,
|
||||
getHttp,
|
||||
getUrlPresets,
|
||||
setUrlPresets,
|
||||
getViewSettings,
|
||||
setViewSettings,
|
||||
setOsc,
|
||||
setHttp,
|
||||
getAutomation,
|
||||
setAutomation,
|
||||
getRundown,
|
||||
@@ -104,14 +98,6 @@ async function setSettings(newData: Settings): ReadonlyPromise<Settings> {
|
||||
return db.data.settings;
|
||||
}
|
||||
|
||||
function getOsc(): Readonly<OSCSettings> {
|
||||
return db.data.osc;
|
||||
}
|
||||
|
||||
function getHttp(): Readonly<HttpSettings> {
|
||||
return db.data.http;
|
||||
}
|
||||
|
||||
function getUrlPresets(): Readonly<URLPreset[]> {
|
||||
return db.data.urlPresets;
|
||||
}
|
||||
@@ -132,19 +118,6 @@ async function setViewSettings(newData: ViewSettings): ReadonlyPromise<ViewSetti
|
||||
return db.data.viewSettings;
|
||||
}
|
||||
|
||||
async function setOsc(newData: OSCSettings): ReadonlyPromise<OSCSettings> {
|
||||
db.data.osc = { ...newData };
|
||||
await persist();
|
||||
return db.data.osc;
|
||||
}
|
||||
|
||||
async function setHttp(newData: HttpSettings): ReadonlyPromise<HttpSettings> {
|
||||
db.data.http = { ...newData };
|
||||
|
||||
await persist();
|
||||
return db.data.http;
|
||||
}
|
||||
|
||||
function getAutomation(): Readonly<AutomationSettings> {
|
||||
return db.data.automation;
|
||||
}
|
||||
@@ -165,8 +138,6 @@ async function mergeIntoData(newData: Partial<DatabaseModel>): ReadonlyPromise<D
|
||||
db.data.settings = mergedData.settings;
|
||||
db.data.viewSettings = mergedData.viewSettings;
|
||||
db.data.automation = mergedData.automation;
|
||||
db.data.osc = mergedData.osc;
|
||||
db.data.http = mergedData.http;
|
||||
db.data.urlPresets = mergedData.urlPresets;
|
||||
db.data.customFields = mergedData.customFields;
|
||||
db.data.rundown = mergedData.rundown;
|
||||
|
||||
@@ -11,8 +11,6 @@ export function safeMerge(existing: DatabaseModel, newData: Partial<DatabaseMode
|
||||
viewSettings = {},
|
||||
urlPresets = existing.urlPresets,
|
||||
customFields = existing.customFields,
|
||||
osc = {},
|
||||
http = {},
|
||||
automation = existing.automation,
|
||||
} = newData;
|
||||
|
||||
|
||||
@@ -35,18 +35,6 @@ describe('safeMerge', () => {
|
||||
lighting: { type: 'string', label: 'lighting', colour: 'red' },
|
||||
vfx: { type: 'string', label: 'vfx', colour: 'blue' },
|
||||
},
|
||||
osc: {
|
||||
portIn: 8888,
|
||||
portOut: 9999,
|
||||
targetIP: '127.0.0.1',
|
||||
enabledIn: false,
|
||||
enabledOut: false,
|
||||
subscriptions: [],
|
||||
},
|
||||
http: {
|
||||
enabledOut: false,
|
||||
subscriptions: [],
|
||||
},
|
||||
automation: {
|
||||
enabledAutomations: false,
|
||||
enabledOscIn: false,
|
||||
@@ -107,38 +95,6 @@ describe('safeMerge', () => {
|
||||
language: 'pt',
|
||||
});
|
||||
});
|
||||
it('merges the osc key', () => {
|
||||
const newData = {
|
||||
osc: {
|
||||
portIn: 7777,
|
||||
subscriptions: [
|
||||
{
|
||||
id: 'unique',
|
||||
cycle: 'onStart',
|
||||
message: 'new message',
|
||||
enabled: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
//@ts-expect-error -- testing partial merge
|
||||
const mergedData = safeMerge(existing, newData);
|
||||
expect(mergedData.osc).toMatchObject({
|
||||
portIn: 7777,
|
||||
portOut: 9999,
|
||||
targetIP: '127.0.0.1',
|
||||
enabledIn: false,
|
||||
enabledOut: false,
|
||||
subscriptions: [
|
||||
{
|
||||
id: 'unique',
|
||||
cycle: 'onStart',
|
||||
message: 'new message',
|
||||
enabled: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it('should merge the urlPresets key when present', () => {
|
||||
const existingData = {
|
||||
@@ -167,17 +123,12 @@ describe('safeMerge', () => {
|
||||
} as ViewSettings,
|
||||
urlPresets: [],
|
||||
customFields: {},
|
||||
osc: {
|
||||
portIn: 8888,
|
||||
portOut: 9999,
|
||||
targetIP: '127.0.0.1',
|
||||
enabledIn: false,
|
||||
enabledOut: false,
|
||||
subscriptions: [],
|
||||
},
|
||||
http: {
|
||||
enabledOut: false,
|
||||
subscriptions: [],
|
||||
automation: {
|
||||
enabledAutomations: false,
|
||||
enabledOscIn: false,
|
||||
oscPortIn: 8000,
|
||||
automations: [],
|
||||
blueprints: {},
|
||||
},
|
||||
} as DatabaseModel;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user