refactor(core): Remove license from execution repository (no-changelog) (#9726)

This commit is contained in:
Iván Ovejero 2024-06-13 11:43:21 +02:00 committed by GitHub
parent 58f00bbacd
commit 6a43710859
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 9 deletions

View file

@ -35,7 +35,6 @@ import type {
} from '@/Interfaces';
import config from '@/config';
import { isAdvancedExecutionFiltersEnabled } from '@/executions/executionHelpers';
import type { ExecutionData } from '../entities/ExecutionData';
import { ExecutionEntity } from '../entities/ExecutionEntity';
import { ExecutionMetadata } from '../entities/ExecutionMetadata';
@ -70,7 +69,7 @@ function parseFiltersToQueryBuilder(
if (filters?.finished) {
qb.andWhere({ finished: filters.finished });
}
if (filters?.metadata && isAdvancedExecutionFiltersEnabled()) {
if (filters?.metadata) {
qb.leftJoin(ExecutionMetadata, 'md', 'md.executionId = execution.id');
for (const md of filters.metadata) {
qb.andWhere('md.key = :key AND md.value = :value', md);

View file

@ -40,6 +40,7 @@ import type { ExecutionEntity } from '@/databases/entities/ExecutionEntity';
import { QueuedExecutionRetryError } from '@/errors/queued-execution-retry.error';
import { ConcurrencyControlService } from '@/concurrency/concurrency-control.service';
import { AbortedExecutionRetryError } from '@/errors/aborted-execution-retry.error';
import { License } from '@/License';
export const schemaGetExecutionsQueryFilter = {
$id: '/IGetExecutionsQueryFilter',
@ -90,6 +91,7 @@ export class ExecutionService {
private readonly waitTracker: WaitTracker,
private readonly workflowRunner: WorkflowRunner,
private readonly concurrencyControl: ConcurrencyControlService,
private readonly license: License,
) {}
async findOne(
@ -249,6 +251,10 @@ export class ExecutionService {
}
}
if (requestFilters?.metadata && !this.license.isAdvancedExecutionFiltersEnabled()) {
delete requestFilters.metadata;
}
await this.executionRepository.deleteExecutionsByFilter(requestFilters, sharedWorkflowIds, {
deleteBefore,
ids,

View file

@ -1,6 +1,4 @@
import { Container } from 'typedi';
import type { ExecutionStatus } from 'n8n-workflow';
import { License } from '@/License';
import type { IExecutionFlattedDb, IExecutionResponse } from '@/Interfaces';
export function getStatusUsingPreviousExecutionStatusMethod(
@ -18,8 +16,3 @@ export function getStatusUsingPreviousExecutionStatusMethod(
return 'unknown';
}
}
export function isAdvancedExecutionFiltersEnabled(): boolean {
const license = Container.get(License);
return license.isAdvancedExecutionFiltersEnabled();
}

View file

@ -16,6 +16,8 @@ describe('ExecutionService', () => {
mock(),
mock(),
mock(),
mock(),
mock(),
);
it('should error on retrying an aborted execution', async () => {