fix(core): Remove circular dependency in WorkflowService and ActiveWorkflowRunner (#8128)

## Summary
A circular dependency between `WorkflowService` and
`ActiveWorkflowRunner` is sometimes causing `this.activeWorkflowRunner`
to be `undefined` in `WorkflowService`.
Breaking this circular dependency should hopefully fix this issue.

## Related tickets and issues
#8122


## Review / Merge checklist
- [x] PR title and summary are descriptive
- [ ] Tests included
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-12-21 17:37:08 +01:00
committed by GitHub
parent e9c7fd7397
commit 21788d9153
9 changed files with 98 additions and 86 deletions

View File

@@ -18,6 +18,7 @@ import type { CredentialsEntity } from '@db/entities/CredentialsEntity';
import { SharedWorkflowRepository } from '@db/repositories/sharedWorkflow.repository';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { NotFoundError } from '@/errors/response-errors/not-found.error';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
@Service()
export class EnterpriseWorkflowService {
@@ -26,6 +27,7 @@ export class EnterpriseWorkflowService {
private readonly userService: UserService,
private readonly roleService: RoleService,
private readonly sharedWorkflowRepository: SharedWorkflowRepository,
private readonly workflowRepository: WorkflowRepository,
) {}
async isOwned(
@@ -182,7 +184,7 @@ export class EnterpriseWorkflowService {
}
async preventTampering(workflow: WorkflowEntity, workflowId: string, user: User) {
const previousVersion = await this.workflowService.get({ id: workflowId });
const previousVersion = await this.workflowRepository.get({ id: workflowId });
if (!previousVersion) {
throw new NotFoundError('Workflow not found');