mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2026-07-08 14:38:00 +02:00
021add0f39
This is a continuation of migrating all rest endpoints to decorated controller classes
26 lines
782 B
TypeScript
26 lines
782 B
TypeScript
import { Service } from 'typedi';
|
|
import { Authorized, Get, RestController } from '@/decorators';
|
|
import { WorkflowRequest } from '@/requests';
|
|
import { ActiveWorkflowsService } from '@/services/activeWorkflows.service';
|
|
|
|
@Service()
|
|
@Authorized()
|
|
@RestController('/active-workflows')
|
|
export class ActiveWorkflowsController {
|
|
constructor(private readonly activeWorkflowsService: ActiveWorkflowsService) {}
|
|
|
|
@Get('/')
|
|
async getActiveWorkflows(req: WorkflowRequest.GetAllActive) {
|
|
return this.activeWorkflowsService.getAllActiveIdsFor(req.user);
|
|
}
|
|
|
|
@Get('/error/:id')
|
|
async getActivationError(req: WorkflowRequest.GetActivationError) {
|
|
const {
|
|
user,
|
|
params: { id: workflowId },
|
|
} = req;
|
|
return this.activeWorkflowsService.getActivationError(workflowId, user);
|
|
}
|
|
}
|