feat: allow dissolving a block

This commit is contained in:
Carlos Valente
2025-05-16 21:01:24 +02:00
committed by Carlos Valente
parent 7a6ecd8c34
commit 5cefad3666
7 changed files with 140 additions and 3 deletions
@@ -11,6 +11,7 @@ import {
deleteAllEntries,
deleteEvent,
editEvent,
dissolveBlock,
reorderEntry,
swapEvents,
} from '../../services/rundown-service/RundownService.js';
@@ -126,6 +127,16 @@ export async function rundownApplyDelay(req: Request, res: Response<MessageRespo
}
}
export async function rundownDissolveBlock(req: Request, res: Response<Rundown | ErrorResponse>) {
try {
const newRundown = await dissolveBlock(req.params.eventId);
res.status(200).send(newRundown);
} catch (error) {
const message = getErrorMessage(error);
res.status(400).send({ message });
}
}
export async function rundownDelete(_req: Request, res: Response<MessageResponse | ErrorResponse>) {
try {
await deleteAllEntries();
@@ -5,6 +5,7 @@ import {
rundownApplyDelay,
rundownBatchPut,
rundownDelete,
rundownDissolveBlock,
rundownGetAll,
rundownGetById,
rundownGetCurrent,
@@ -37,6 +38,7 @@ router.put('/batch', rundownBatchPutValidator, rundownBatchPut);
router.patch('/reorder/', rundownReorderValidator, rundownReorder);
router.patch('/swap', rundownSwapValidator, rundownSwap);
router.patch('/applydelay/:eventId', paramsMustHaveEventId, rundownApplyDelay);
router.post('/dissolve/:eventId', paramsMustHaveEventId, rundownDissolveBlock);
router.delete('/', rundownArrayOfIds, deletesEventById);
router.delete('/all', rundownDelete);