mirror of
https://github.com/cpvalente/ontime.git
synced 2026-09-01 20:39:18 +00:00
style: run code formatting
This commit is contained in:
committed by
Carlos Valente
parent
7bd98c23a4
commit
9dfc8083f0
@@ -98,21 +98,25 @@ router.post('/', rundownPostValidator, async (req: Request, res: Response<Projec
|
|||||||
/**
|
/**
|
||||||
* Duplicates an existing rundown
|
* Duplicates an existing rundown
|
||||||
*/
|
*/
|
||||||
router.post('/:id/duplicate', paramsWithId, async (req: Request, res: Response<ProjectRundownsList | ErrorResponse>) => {
|
router.post(
|
||||||
try {
|
'/:id/duplicate',
|
||||||
const dataProvider = getDataProvider();
|
paramsWithId,
|
||||||
const rundown = dataProvider.getRundown(req.params.id);
|
async (req: Request, res: Response<ProjectRundownsList | ErrorResponse>) => {
|
||||||
|
try {
|
||||||
|
const dataProvider = getDataProvider();
|
||||||
|
const rundown = dataProvider.getRundown(req.params.id);
|
||||||
|
|
||||||
const duplicatedRundown: Rundown = duplicateRundown(rundown, `Copy of ${rundown.title}`);
|
const duplicatedRundown: Rundown = duplicateRundown(rundown, `Copy of ${rundown.title}`);
|
||||||
await dataProvider.setRundown(duplicatedRundown.id, duplicatedRundown);
|
await dataProvider.setRundown(duplicatedRundown.id, duplicatedRundown);
|
||||||
|
|
||||||
const projectRundowns = getDataProvider().getProjectRundowns();
|
const projectRundowns = getDataProvider().getProjectRundowns();
|
||||||
res.status(201).json({ loaded: getCurrentRundown().id, rundowns: normalisedToRundownArray(projectRundowns) });
|
res.status(201).json({ loaded: getCurrentRundown().id, rundowns: normalisedToRundownArray(projectRundowns) });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const message = getErrorMessage(error);
|
const message = getErrorMessage(error);
|
||||||
res.status(400).send({ message });
|
res.status(400).send({ message });
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Patches the data of an existing rundown
|
* Patches the data of an existing rundown
|
||||||
@@ -128,7 +132,7 @@ router.patch('/:id', paramsWithId, async (req: Request, res: Response<ProjectRun
|
|||||||
await dataProvider.setRundown(rundown.id, { ...rundown, title: req.body.title });
|
await dataProvider.setRundown(rundown.id, { ...rundown, title: req.body.title });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If loaded we re-init the rundown
|
* If loaded we re-init the rundown
|
||||||
* This is likely over-kill but the simplest way to ensure state consistency
|
* This is likely over-kill but the simplest way to ensure state consistency
|
||||||
*/
|
*/
|
||||||
if (req.params.id === getCurrentRundown().id) {
|
if (req.params.id === getCurrentRundown().id) {
|
||||||
|
|||||||
@@ -519,7 +519,6 @@ export function normalisedToRundownArray(rundowns: ProjectRundowns): ProjectRund
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duplicates an existing rundown ensuring all IDs are unique
|
* Duplicates an existing rundown ensuring all IDs are unique
|
||||||
*/
|
*/
|
||||||
@@ -532,4 +531,4 @@ export function duplicateRundown(rundown: Rundown, newTitle: string): Rundown {
|
|||||||
newRundown.revision = 0;
|
newRundown.revision = 0;
|
||||||
|
|
||||||
return newRundown;
|
return newRundown;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user