refactor(core): Move active workflows endpoints to a decorated controller class (no-changelog) (#8101)
This is a continuation of migrating all rest endpoints to decorated controller classes
This commit is contained in:
committed by
GitHub
parent
39e45d8b92
commit
021add0f39
25
packages/cli/src/controllers/activeWorkflows.controller.ts
Normal file
25
packages/cli/src/controllers/activeWorkflows.controller.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user