fix: osc new project (#1032)

This commit is contained in:
Alex Christoffer Rasmussen
2024-06-02 18:01:36 +02:00
committed by GitHub
parent 3895b37572
commit ec55236eb2
2 changed files with 24 additions and 0 deletions
@@ -19,6 +19,9 @@ import * as projectService from '../../services/project-service/ProjectService.j
import { ensureJsonExtension } from '../../utils/fileManagement.js';
import { generateUniqueFileName } from '../../utils/generateUniqueFilename.js';
import { appStateService } from '../../services/app-state-service/AppStateService.js';
import { oscIntegration } from '../../services/integration-service/OscIntegration.js';
import { httpIntegration } from '../../services/integration-service/HttpIntegration.js';
import { DataProvider } from '../../classes/data-provider/DataProvider.js';
export async function patchPartialProjectFile(req: Request, res: Response<DatabaseModel | ErrorResponse>) {
// all fields are optional in validation
@@ -32,6 +35,7 @@ export async function patchPartialProjectFile(req: Request, res: Response<Databa
const patchDb: DatabaseModel = { rundown, project, settings, viewSettings, urlPresets, customFields, osc, http };
const newData = await projectService.applyDataModel(patchDb);
res.status(200).send(newData);
} catch (error) {
const message = getErrorMessage(error);
@@ -125,6 +129,12 @@ export async function postProjectFile(req: Request, res: Response<MessageRespons
await projectService.handleUploadedFile(path, filename);
await projectService.applyProjectFile(filename, options);
const oscSettings = await DataProvider.getOsc();
const httpSettings = await DataProvider.getHttp();
oscIntegration.init(oscSettings);
httpIntegration.init(httpSettings);
res.status(201).send({
message: `Loaded project ${filename}`,
});
@@ -159,6 +169,12 @@ export async function loadProject(req: Request, res: Response<MessageResponse |
await projectService.applyProjectFile(name);
const oscSettings = await DataProvider.getOsc();
const httpSettings = await DataProvider.getHttp();
oscIntegration.init(oscSettings);
httpIntegration.init(httpSettings);
res.status(201).send({
message: `Loaded project ${name}`,
});