mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-09 09:23:51 +00:00
refactor(rundown): cap rundown names to 64 characters
This commit is contained in:
committed by
Carlos Valente
parent
514b6c3a02
commit
608247157b
@@ -46,7 +46,7 @@ export function ManageRundownForm({ onClose }: ManageRundownForm) {
|
||||
<Panel.Section>
|
||||
<label>
|
||||
<Panel.Description>Rundown title</Panel.Description>
|
||||
<Input {...register('title')} fluid placeholder='Your rundown name' />
|
||||
<Input {...register('title')} maxLength={64} fluid placeholder='Your rundown name' />
|
||||
</label>
|
||||
</Panel.Section>
|
||||
<Panel.InlineElements relation='inner' align='end'>
|
||||
|
||||
+1
@@ -59,6 +59,7 @@ export default function RundownRenameForm({ onSubmit, onCancel, initialTitle }:
|
||||
return true;
|
||||
},
|
||||
})}
|
||||
maxLength={64}
|
||||
fluid
|
||||
/>
|
||||
{errors.title && <Panel.Error>{errors.title.message}</Panel.Error>}
|
||||
|
||||
@@ -1,14 +1,23 @@
|
||||
import { body, param } from 'express-validator';
|
||||
import type { EntryId, InsertOptions, OntimeGroup, Rundown } from 'ontime-types';
|
||||
import { type EntryId, type InsertOptions, type OntimeGroup, type Rundown } from 'ontime-types';
|
||||
|
||||
import { requestValidationFunction } from '../validation-utils/validationFunction.js';
|
||||
|
||||
// #region operations on project rundowns =========================
|
||||
|
||||
export const rundownPostValidator = [body('title').isString().trim().notEmpty(), requestValidationFunction];
|
||||
const rundownTitleValidator = body('title')
|
||||
.isString()
|
||||
.trim()
|
||||
.notEmpty()
|
||||
.withMessage('No title provided')
|
||||
.bail()
|
||||
.isLength({ max: 64 })
|
||||
.withMessage('Title must be 64 characters or fewer');
|
||||
|
||||
export const rundownPostValidator = [rundownTitleValidator, requestValidationFunction];
|
||||
export const rundownPatchValidator = [
|
||||
param('id').isString().trim().notEmpty(),
|
||||
body('title').isString().trim().notEmpty().withMessage('No title provided'),
|
||||
rundownTitleValidator,
|
||||
requestValidationFunction,
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user