mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-06-14 03:46:49 +03:00
first try
This commit is contained in:
@@ -4,6 +4,7 @@ import { IP_OR_HOSTNAME_VALIDATOR } from 'validators/shared';
|
||||
|
||||
import type {
|
||||
AnalogSensor,
|
||||
CommandItem,
|
||||
DeviceValue,
|
||||
EntityItem,
|
||||
ScheduleItem,
|
||||
@@ -237,6 +238,24 @@ export const schedulerItemValidation = (
|
||||
NAME_PATTERN_REQUIRED,
|
||||
uniqueNameValidator(schedule, scheduleItem.o_name)
|
||||
],
|
||||
cmd_name: [
|
||||
{ required: true, message: 'Command is required' }
|
||||
]
|
||||
});
|
||||
|
||||
export const uniqueCommandNameValidator = (commands: CommandItem[], o_name?: string) =>
|
||||
createUniqueNameValidator(commands, o_name);
|
||||
|
||||
export const commandItemValidation = (
|
||||
commands: CommandItem[],
|
||||
commandItem: CommandItem
|
||||
) =>
|
||||
new Schema({
|
||||
name: [
|
||||
{ required: true, message: 'Name is required' },
|
||||
NAME_PATTERN_REQUIRED,
|
||||
uniqueCommandNameValidator(commands, commandItem.o_name)
|
||||
],
|
||||
cmd: [
|
||||
{ required: true, message: 'Command is required' },
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user