mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 19:32:15 +00:00
feat(API): Add cancel status filters to the public api executions endpoint (#19136)
This commit is contained in:
@@ -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[] },
|
||||
|
||||
Reference in New Issue
Block a user