Fix: rundown import (#1795)

* fix: patch in the active rundown id and title

* fix: send a ALL refetch on project patch

* fix: load the last used rundown on project patch and not just the first one

* chore: lint

* chore: clean up and let rundown service send the refetch request

* chore: dont destructure rundown
This commit is contained in:
Alex Christoffer Rasmussen
2025-09-25 10:49:16 +02:00
parent bc0b83aa14
commit 80e4dc0941
3 changed files with 12 additions and 6 deletions
@@ -31,7 +31,6 @@ export async function patchPartialProjectFile(req: Request, res: Response<Databa
};
const newData = await projectService.patchCurrentProject(patchDb);
res.status(200).send(newData);
} catch (error) {
const message = getErrorMessage(error);
@@ -323,11 +323,14 @@ export async function patchCurrentProject(data: Partial<DatabaseModel>) {
/**
* The user may have multiple rundowns
* We currently ignore all other rundowns
* so attempt to get the one that was used last
* otherwise just pick the first
*/
const firstRundown = getFirstRundown(result);
const last = await getLastLoaded();
const rundownToLoad =
last?.rundownId && last.rundownId in result ? result[last.rundownId] : getFirstRundown(result);
await initRundown(firstRundown, customFields);
await initRundown(rundownToLoad, customFields, true);
}
const updatedData = await getDataProvider().getData();