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:
कारतोफ्फेलस्क्रिप्ट™
2023-12-22 11:28:42 +01:00
committed by GitHub
parent 39e45d8b92
commit 021add0f39
12 changed files with 226 additions and 133 deletions

View 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);
}
}