Files
ontime/apps/server/src/api-data/rundown/rundown.validation.ts
T
Alex Christoffer Rasmussen 41a09bf5c3 fix: send refetch on all rundown edits (#2098)
* fix(server): send refetch on all rundown edits

* fix(test): cuesheet tabing

* chore: remove unneeded async

* refactor: small cleanups

* chore: spelling

Co-authored-by: Carlos Valente <34649812+cpvalente@users.noreply.github.com>

* chore: remove unneded async/await

---------

Co-authored-by: Carlos Valente <34649812+cpvalente@users.noreply.github.com>
2026-06-20 12:21:11 +02:00

76 lines
2.1 KiB
TypeScript

import { body, param } from 'express-validator';
import { requestValidationFunction } from '../validation-utils/validationFunction.js';
// #region operations on project rundowns =========================
export const rundownPostValidator = [body('title').isString().trim().notEmpty(), requestValidationFunction];
export const rundownPatchValidator = [
param('id').isString().trim().notEmpty(),
body('title').isString().trim().notEmpty().withMessage('No title provided'),
requestValidationFunction,
];
// #endregion operations on project rundowns ======================
// #region operations on rundown entries ==========================
export const entryPostValidator = [
body('type').isString().isIn(['event', 'delay', 'group', 'milestone']),
body('after').optional().isString(),
body('before').optional().isString(),
requestValidationFunction,
];
export const clonePostValidator = [
body('after').optional().isString(),
body('before').optional().isString(),
requestValidationFunction,
];
export const entryPutValidator = [body('id').isString().trim().notEmpty(), requestValidationFunction];
export const entryBatchPutValidator = [
body('data').isObject(),
body('ids').isArray().notEmpty(),
body('ids.*').isString(),
requestValidationFunction,
];
export const entryReorderValidator = [
body('entryId').isString().notEmpty(),
body('destinationId').isString().notEmpty(),
body('order').isIn(['before', 'after', 'insert']),
requestValidationFunction,
];
export const entrySwapValidator = [
body('from').isString().notEmpty(),
body('to').isString().notEmpty(),
requestValidationFunction,
];
export const paramsMustHaveEntryId = [param('entryId').isString().notEmpty(), requestValidationFunction];
export const rundownArrayOfIds = [
body('ids').isArray().notEmpty(),
body('ids.*').isString(),
requestValidationFunction,
];
export const entryRenumberValidator = [
body('ids').isArray().notEmpty(),
body('ids.*').isString(),
body('prefix').isString(),
body('start').isDecimal(),
body('increment').isDecimal(),
requestValidationFunction,
];
// #endregion operations on rundown entries =======================