mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-22 07:29:08 +00:00
feat: auto cue re-numbering (#2016)
* feat: update auto cue numbering * feat: renumber from ui * refactor: patchEntries is not used * chore: format * fix: correct cue at top of group * fix: handle precision * refactor dialog * bump limit for performance time test * extract type * add class name to lable * fix rebase * refator: extract renumering logic * chore: comments for getIntegerAndFraction function * chore: add the for renumber mutation * fix: fraction match precision * refactor: small cleanup * refactor: use more narrow validator --------- Co-authored-by: alex-Arc <omnivox@LAPTOP-RC5SNBVV.localdomain>
This commit is contained in:
committed by
GitHub
parent
ba1c3235b3
commit
1a08b39b8b
@@ -1,6 +1,7 @@
|
||||
import type { Request, Response, Router } from 'express';
|
||||
import express from 'express';
|
||||
import { ErrorResponse, OntimeEntry, ProjectRundownsList, Rundown } from 'ontime-types';
|
||||
import { matchedData } from 'express-validator';
|
||||
import { ErrorResponse, OntimeEntry, ProjectRundownsList, RenumberCues, Rundown } from 'ontime-types';
|
||||
import { getErrorMessage } from 'ontime-utils';
|
||||
|
||||
import { getDataProvider } from '../../classes/data-provider/DataProvider.js';
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
groupEntries,
|
||||
initRundown,
|
||||
loadRundown,
|
||||
renumberEntries,
|
||||
reorderEntry,
|
||||
swapEvents,
|
||||
ungroupEntries,
|
||||
@@ -28,6 +30,7 @@ import {
|
||||
entryBatchPutValidator,
|
||||
entryPostValidator,
|
||||
entryPutValidator,
|
||||
entryRenumberValidator,
|
||||
entryReorderValidator,
|
||||
entrySwapValidator,
|
||||
rundownArrayOfIds,
|
||||
@@ -373,4 +376,23 @@ router.delete(
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* Reorders two entries in a rundown
|
||||
*/
|
||||
router.patch(
|
||||
'/:rundownId/renumber',
|
||||
entryRenumberValidator,
|
||||
validateRundownMutation,
|
||||
(req: Request, res: Response<Rundown | ErrorResponse>) => {
|
||||
try {
|
||||
const { ids, prefix, start, increment } = matchedData<RenumberCues>(req);
|
||||
const rundown = renumberEntries(ids, prefix, start, increment);
|
||||
res.status(200).send(rundown);
|
||||
} catch (error) {
|
||||
const message = getErrorMessage(error);
|
||||
res.status(400).send({ message });
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// #endregion operations on rundown entries =======================
|
||||
|
||||
Reference in New Issue
Block a user