feat(API): Add cancel status filters to the public api executions endpoint (#19136)

This commit is contained in:
Irénée
2025-09-04 08:35:25 +01:00
committed by GitHub
parent a794ab6be3
commit 4a21f79f5c
6 changed files with 288 additions and 123 deletions

View File

@@ -7,7 +7,7 @@ import {
AnnotationTagRepository,
} from '@n8n/db';
import { Container } from '@n8n/di';
import type { AnnotationVote, IWorkflowBase } from 'n8n-workflow';
import type { AnnotationVote, ExecutionStatus, IWorkflowBase } from 'n8n-workflow';
import { ExecutionService } from '@/executions/execution.service';
import { Telemetry } from '@/telemetry';
@@ -104,6 +104,20 @@ export async function createWaitingExecution(workflow: IWorkflowBase) {
);
}
/**
* Store an execution with a given status in the DB and assign it to a workflow.
*/
export async function createdExecutionWithStatus(workflow: IWorkflowBase, status: ExecutionStatus) {
const execution: Partial<ExecutionEntity> = {
status,
finished: status === 'success' ? true : false,
stoppedAt: ['crashed', 'error'].includes(status) ? new Date() : undefined,
waitTill: status === 'waiting' ? new Date() : undefined,
};
return await createExecution(execution, workflow);
}
export async function annotateExecution(
executionId: string,
annotation: { vote?: AnnotationVote | null; tags?: string[] },