mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-10 01:43:43 +00:00
fix: api change custom fields (#1888)
* fix: validate nested custom path * chore: add test
This commit is contained in:
committed by
GitHub
parent
80ec2d1186
commit
f128f7acd2
@@ -18,7 +18,7 @@ import { validateMessage, validateTimerMessage } from '../services/message-servi
|
||||
import { runtimeService } from '../services/runtime-service/runtime.service.js';
|
||||
import { eventStore } from '../stores/EventStore.js';
|
||||
import * as assert from '../utils/assert.js';
|
||||
import { parseProperty } from './integration.utils.js';
|
||||
import { parseProperty, isValidChangeProperty } from './integration.utils.js';
|
||||
import { socket } from '../adapters/WebsocketAdapter.js';
|
||||
import { throttle } from '../utils/throttle.js';
|
||||
import { coerceEnum } from '../utils/coerceType.js';
|
||||
@@ -77,10 +77,9 @@ const actionHandlers: Record<ApiActionTag, ActionHandler> = {
|
||||
let shouldThrottle = false;
|
||||
|
||||
Object.entries(data).forEach(([property, value]) => {
|
||||
if (typeof property !== 'string' || value === undefined || !(property in targetEntry)) {
|
||||
if (!isValidChangeProperty(targetEntry, property, value)) {
|
||||
throw new Error('Invalid property or value');
|
||||
}
|
||||
// parseProperty is async because of the data lock
|
||||
const newObjectProperty = parseProperty(property, value);
|
||||
const key = Object.keys(newObjectProperty)[0];
|
||||
shouldThrottle = shouldThrottle || willCauseRegeneration(key);
|
||||
|
||||
Reference in New Issue
Block a user