diff --git a/packages/@n8n/db/src/repositories/execution.repository.ts b/packages/@n8n/db/src/repositories/execution.repository.ts index c86feea5d9412..3d0e9c77a33a8 100644 --- a/packages/@n8n/db/src/repositories/execution.repository.ts +++ b/packages/@n8n/db/src/repositories/execution.repository.ts @@ -706,6 +706,7 @@ export class ExecutionRepository extends Repository { 'workflowId', 'waitTill', 'finished', + 'status', ], where, order: { id: 'DESC' }, diff --git a/packages/cli/src/public-api/v1/handlers/executions/spec/schemas/execution.yml b/packages/cli/src/public-api/v1/handlers/executions/spec/schemas/execution.yml index ce40c69ceede0..936b1961dad8f 100644 --- a/packages/cli/src/public-api/v1/handlers/executions/spec/schemas/execution.yml +++ b/packages/cli/src/public-api/v1/handlers/executions/spec/schemas/execution.yml @@ -33,3 +33,6 @@ properties: format: date-time customData: type: object + status: + type: string + enum: ['canceled', 'crashed', 'error', 'new', 'running', 'success', 'unknown', 'waiting'] diff --git a/packages/cli/test/integration/public-api/executions.test.ts b/packages/cli/test/integration/public-api/executions.test.ts index c423f0710a2ba..fabbd80cf3ba6 100644 --- a/packages/cli/test/integration/public-api/executions.test.ts +++ b/packages/cli/test/integration/public-api/executions.test.ts @@ -263,6 +263,7 @@ describe('GET /executions', () => { stoppedAt, workflowId, waitTill, + status, } = response.body.data[0]; expect(id).toBeDefined(); @@ -274,6 +275,7 @@ describe('GET /executions', () => { expect(stoppedAt).not.toBeNull(); expect(workflowId).toBe(successfulExecution.workflowId); expect(waitTill).toBeNull(); + expect(status).toBe(successfulExecution.status); }); test('should paginate two executions', async () => { @@ -317,6 +319,7 @@ describe('GET /executions', () => { stoppedAt, workflowId, waitTill, + status, } = executions[i]; expect(id).toBeDefined(); @@ -328,6 +331,7 @@ describe('GET /executions', () => { expect(stoppedAt).not.toBeNull(); expect(workflowId).toBe(successfulExecutions[i].workflowId); expect(waitTill).toBeNull(); + expect(status).toBe(successfulExecutions[i].status); } }); @@ -356,6 +360,7 @@ describe('GET /executions', () => { stoppedAt, workflowId, waitTill, + status, } = response.body.data[0]; expect(id).toBeDefined(); @@ -367,6 +372,7 @@ describe('GET /executions', () => { expect(stoppedAt).not.toBeNull(); expect(workflowId).toBe(errorExecution.workflowId); expect(waitTill).toBeNull(); + expect(status).toBe(errorExecution.status); }); test('should return all waiting executions', async () => { @@ -396,6 +402,7 @@ describe('GET /executions', () => { stoppedAt, workflowId, waitTill, + status, } = response.body.data[0]; expect(id).toBeDefined(); @@ -407,6 +414,7 @@ describe('GET /executions', () => { expect(stoppedAt).not.toBeNull(); expect(workflowId).toBe(waitingExecution.workflowId); expect(new Date(waitTill).getTime()).toBeGreaterThan(Date.now() - 1000); + expect(status).toBe(waitingExecution.status); }); test('should retrieve all executions of specific workflow', async () => { @@ -434,6 +442,7 @@ describe('GET /executions', () => { stoppedAt, workflowId, waitTill, + status, } = execution; expect(savedExecutions.some((exec) => exec.id === id)).toBe(true); @@ -445,6 +454,7 @@ describe('GET /executions', () => { expect(stoppedAt).not.toBeNull(); expect(workflowId).toBe(workflow.id); expect(waitTill).toBeNull(); + expect(status).toBe(execution.status); } });