feat: implement custom project data image

This commit is contained in:
Carlos Valente
2025-07-11 18:42:09 +02:00
parent d8c1c38123
commit 138c6523d2
13 changed files with 130 additions and 116 deletions
@@ -1,7 +1,6 @@
import { DatabaseModel, LogOrigin, ProjectData, ProjectFileListResponse } from 'ontime-types';
import { DatabaseModel, LogOrigin, ProjectFileListResponse } from 'ontime-types';
import { getErrorMessage, getFirstRundown } from 'ontime-utils';
import { join } from 'path';
import { copyFile } from 'fs/promises';
import { logger } from '../../classes/Logger.js';
@@ -312,23 +311,3 @@ export async function patchCurrentProject(data: Partial<DatabaseModel>) {
const updatedData = await getDataProvider().getData();
return updatedData;
}
/**
* Patches the current project data
* Handles deleting the local logo if the logo has been removed
*/
export async function editCurrentProjectData(newData: Partial<ProjectData>) {
const currentProjectData = getDataProvider().getProjectData();
const updatedProjectData = await getDataProvider().setProjectData(newData);
// Delete the old logo if the logo has been removed
if (!updatedProjectData.logo && currentProjectData.logo) {
const filePath = join(publicDir.logoDir, currentProjectData.logo);
deleteFile(filePath).catch((_error) => {
/** we do not handle this error */
});
}
return updatedProjectData;
}