feat(core): Execution curation (#10342)

Co-authored-by: oleg <me@olegivaniv.com>
This commit is contained in:
Eugene
2024-09-02 15:20:08 +02:00
committed by GitHub
parent 8603946e23
commit 022ddcbef9
75 changed files with 2733 additions and 713 deletions

View File

@@ -5,6 +5,13 @@ import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import { ExecutionRepository } from '@/databases/repositories/execution.repository';
import { ExecutionDataRepository } from '@/databases/repositories/execution-data.repository';
import { ExecutionMetadataRepository } from '@/databases/repositories/execution-metadata.repository';
import { ExecutionService } from '@/executions/execution.service';
import type { AnnotationVote } from 'n8n-workflow';
import { mockInstance } from '@test/mocking';
import { Telemetry } from '@/telemetry';
import { AnnotationTagRepository } from '@/databases/repositories/annotation-tag.repository';
mockInstance(Telemetry);
export async function createManyExecutions(
amount: number,
@@ -85,6 +92,19 @@ export async function createWaitingExecution(workflow: WorkflowEntity) {
);
}
export async function annotateExecution(
executionId: string,
annotation: { vote?: AnnotationVote | null; tags?: string[] },
sharedWorkflowIds: string[],
) {
await Container.get(ExecutionService).annotate(executionId, annotation, sharedWorkflowIds);
}
export async function getAllExecutions() {
return await Container.get(ExecutionRepository).find();
}
export async function createAnnotationTags(annotationTags: string[]) {
const tagRepository = Container.get(AnnotationTagRepository);
return await tagRepository.save(annotationTags.map((name) => tagRepository.create({ name })));
}

View File

@@ -48,11 +48,13 @@ export async function terminate() {
// Can't use `Object.keys(entities)` here because some entities have a `Entity` suffix, while the repositories don't
const repositories = [
'AnnotationTag',
'AuthIdentity',
'AuthProviderSyncHistory',
'Credentials',
'EventDestinations',
'Execution',
'ExecutionAnnotation',
'ExecutionData',
'ExecutionMetadata',
'InstalledNodes',

View File

@@ -26,6 +26,7 @@ type EndpointGroup =
| 'eventBus'
| 'license'
| 'variables'
| 'annotationTags'
| 'tags'
| 'externalSecrets'
| 'mfa'

View File

@@ -122,6 +122,10 @@ export const setupTestServer = ({
if (endpointGroups.length) {
for (const group of endpointGroups) {
switch (group) {
case 'annotationTags':
await import('@/controllers/annotation-tags.controller');
break;
case 'credentials':
await import('@/credentials/credentials.controller');
break;