feat(automation): persist lifecycle triggers atomically

Create and edit automation lifecycle bindings in the same settings save, and validate template-aware OSC and HTTP outputs consistently.
This commit is contained in:
Carlos Valente
2026-09-12 16:47:45 +02:00
parent 1175b3c641
commit 90217108d6
12 changed files with 321 additions and 71 deletions
+9 -4
View File
@@ -4,6 +4,7 @@ import type {
AutomationDTO,
AutomationOutput,
AutomationSettings,
AutomationTriggerDTO,
Trigger,
TriggerDTO,
} from 'ontime-types';
@@ -57,16 +58,20 @@ export function deleteTrigger(id: string): Promise<void> {
/**
* HTTP request to create a new automation
*/
export async function addAutomation(automation: AutomationDTO): Promise<Automation> {
const res = await axios.post(`${automationsPath}/automation`, automation);
export async function addAutomation(automation: AutomationDTO, triggers: AutomationTriggerDTO[]): Promise<Automation> {
const res = await axios.post(`${automationsPath}/automation`, { ...automation, triggers });
return res.data;
}
/**
* HTTP request to update a automation
*/
export async function editAutomation(id: string, automation: Automation): Promise<Automation> {
const res = await axios.put(`${automationsPath}/automation/${id}`, automation);
export async function editAutomation(
id: string,
automation: Automation,
triggers?: AutomationTriggerDTO[],
): Promise<Automation> {
const res = await axios.put(`${automationsPath}/automation/${id}`, { ...automation, triggers });
return res.data;
}