V2 rundown manager (#237)

* refactor: migrate eventlist > rundown
This commit is contained in:
Carlos Valente
2022-10-30 21:07:18 +01:00
committed by GitHub
parent a3f14182a4
commit c03ed07762
55 changed files with 487 additions and 489 deletions
+5 -5
View File
@@ -24,7 +24,7 @@ export const poll = async (req, res) => {
// Returns -
export const dbDownload = async (req, res) => {
const { title } = DataProvider.getEventData();
const fileTitle = title || 'ontime events';
const fileTitle = title || 'ontime data';
const dbInDisk = resolveDbPath();
res.download(dbInDisk, `${fileTitle}.json`, (err) => {
@@ -50,13 +50,13 @@ const uploadAndParse = async (file, req, res, options) => {
} else if (result.message === 'success') {
// explicitly write objects
if (typeof result !== 'undefined') {
const newEvents = result.data.events || [];
if (options?.onlyEvents === 'true') {
await DataProvider.setEvents(newEvents);
const newRundown = result.data.rundown || [];
if (options?.onlyRundown === 'true') {
await DataProvider.setRundown(newRundown);
} else {
await DataProvider.mergeIntoData(result.data);
}
global.timer.setupWithEventList(newEvents.filter((entry) => entry.type === 'event'));
global.timer.setupWithEventList(newRundown.filter((entry) => entry.type === 'event'));
}
res.sendStatus(200);
} else {