Files
n8n-enterprise-unlocked/packages/cli/src/controllers/debug.controller.ts
T
कारतोफ्फेलस्क्रिप्ट™ f69ddcd796 refactor(core): Use Dependency Injection for all Controller classes (no-changelog) (#8146)
## Review / Merge checklist
- [x] PR title and summary are descriptive
2023-12-27 11:50:43 +01:00

34 lines
1.0 KiB
TypeScript

import { Get, RestController } from '@/decorators';
import { ActiveWorkflowRunner } from '@/ActiveWorkflowRunner';
import { MultiMainSetup } from '@/services/orchestration/main/MultiMainSetup.ee';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { In } from 'typeorm';
@RestController('/debug')
export class DebugController {
constructor(
private readonly multiMainSetup: MultiMainSetup,
private readonly activeWorkflowRunner: ActiveWorkflowRunner,
private readonly workflowRepository: WorkflowRepository,
) {}
@Get('/multi-main-setup')
async getMultiMainSetupDetails() {
const leaderKey = await this.multiMainSetup.fetchLeaderKey();
const activeWorkflows = await this.workflowRepository.find({
select: ['id', 'name'],
where: { id: In(this.activeWorkflowRunner.allActiveInMemory()) },
});
const activationErrors = await this.activeWorkflowRunner.getAllWorkflowActivationErrors();
return {
instanceId: this.multiMainSetup.instanceId,
leaderKey,
activeWorkflows,
activationErrors,
};
}
}