feat(automation): create global triggers with automations

This commit is contained in:
Carlos Valente
2026-09-11 19:56:42 +02:00
parent 123692827c
commit 4601770d1d
8 changed files with 203 additions and 25 deletions
+6 -2
View File
@@ -4,6 +4,7 @@ import type {
AutomationDTO,
AutomationOutput,
AutomationSettings,
AutomationTriggerDTO,
Trigger,
TriggerDTO,
} from 'ontime-types';
@@ -57,8 +58,11 @@ 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;
}