refactor: remove userFields (#791)

* refactor: process custom fields on cache generate

* refactor: remove userFields
This commit is contained in:
Carlos Valente
2024-02-27 13:23:12 +01:00
committed by GitHub
parent 429df21557
commit d7392b93d2
73 changed files with 1580 additions and 2290 deletions
@@ -62,6 +62,7 @@ export async function setRundown(initialRundown: OntimeRundown) {
generate();
await DataProvider.setRundown(persistedRundown);
}
/**
* Utility initialises cache
* @param rundown
@@ -89,10 +90,6 @@ export function generate(
// 1. handle links
handleLink(i, initialRundown, updatedEvent, links);
// TODO: wait until the next thing?
// update the persisted event
initialRundown[i] = updatedEvent;
// 2. handle custom fields
handleCustomField(customFields, customFieldChangelog, updatedEvent, assignedCustomFields);
@@ -196,14 +193,12 @@ export function mutateCache<T extends object>(mutation: MutatingFn<T>) {
console.timeEnd('rundownCache__init');
});
// TODO: should we trottle this?
// TODO: should we throttle this?
// defer writing to the database
setImmediate(() => {
console.log('writing to database', persistedRundown.length);
DataProvider.setRundown(persistedRundown);
});
// TODO: could we return a patch object?
return { newEvent };
}