mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
feat(core): Execution curation (#10342)
Co-authored-by: oleg <me@olegivaniv.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { ExecutionRequest, type ExecutionSummaries } from './execution.types';
|
||||
import { ExecutionService } from './execution.service';
|
||||
import { Get, Post, RestController } from '@/decorators';
|
||||
import { validateExecutionUpdatePayload } from './validation';
|
||||
import { Get, Patch, Post, RestController } from '@/decorators';
|
||||
import { EnterpriseExecutionsService } from './execution.service.ee';
|
||||
import { License } from '@/license';
|
||||
import { WorkflowSharingService } from '@/workflows/workflow-sharing.service';
|
||||
@@ -47,7 +48,10 @@ export class ExecutionsController {
|
||||
|
||||
query.accessibleWorkflowIds = accessibleWorkflowIds;
|
||||
|
||||
if (!this.license.isAdvancedExecutionFiltersEnabled()) delete query.metadata;
|
||||
if (!this.license.isAdvancedExecutionFiltersEnabled()) {
|
||||
delete query.metadata;
|
||||
delete query.annotationTags;
|
||||
}
|
||||
|
||||
const noStatus = !query.status || query.status.length === 0;
|
||||
const noRange = !query.range.lastId || !query.range.firstId;
|
||||
@@ -110,4 +114,23 @@ export class ExecutionsController {
|
||||
|
||||
return await this.executionService.delete(req, workflowIds);
|
||||
}
|
||||
|
||||
@Patch('/:id')
|
||||
async update(req: ExecutionRequest.Update) {
|
||||
if (!isPositiveInteger(req.params.id)) {
|
||||
throw new BadRequestError('Execution ID is not a number');
|
||||
}
|
||||
|
||||
const workflowIds = await this.getAccessibleWorkflowIds(req.user, 'workflow:read');
|
||||
|
||||
// Fail fast if no workflows are accessible
|
||||
if (workflowIds.length === 0) throw new NotFoundError('Execution not found');
|
||||
|
||||
const { body: payload } = req;
|
||||
const validatedPayload = validateExecutionUpdatePayload(payload);
|
||||
|
||||
await this.executionService.annotate(req.params.id, validatedPayload, workflowIds);
|
||||
|
||||
return await this.executionService.findOne(req, workflowIds);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user