mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-11 18:33:53 +00:00
refactor: extract regex utilities
This commit is contained in:
committed by
Carlos Valente
parent
44508ce8b4
commit
5bc286145d
@@ -1,4 +1,4 @@
|
||||
import { isAlphanumericWithSpace } from 'ontime-utils';
|
||||
import { checkRegex } from 'ontime-utils';
|
||||
|
||||
import { body, param } from 'express-validator';
|
||||
import { requestValidationFunction } from '../validation-utils/validationFunction.js';
|
||||
@@ -9,7 +9,7 @@ export const validateCustomField = [
|
||||
.trim()
|
||||
.notEmpty()
|
||||
.custom((value) => {
|
||||
return isAlphanumericWithSpace(value);
|
||||
return checkRegex.isAlphanumericWithSpace(value);
|
||||
}),
|
||||
body('type').isIn(['text', 'image']),
|
||||
body('colour').isString().trim(),
|
||||
@@ -24,7 +24,7 @@ export const validateEditCustomField = [
|
||||
.trim()
|
||||
.notEmpty()
|
||||
.custom((value) => {
|
||||
return isAlphanumericWithSpace(value);
|
||||
return checkRegex.isAlphanumericWithSpace(value);
|
||||
}),
|
||||
body('type').isIn(['text', 'image']),
|
||||
body('colour').isString().trim(),
|
||||
|
||||
Reference in New Issue
Block a user