refactor(core): Simplify OrchestrationService (no-changelog) (#8364)

This commit is contained in:
Iván Ovejero
2024-01-22 11:16:29 +01:00
committed by GitHub
parent 2ccb754e52
commit f35d4fcbd8
28 changed files with 323 additions and 315 deletions

View File

@@ -1,13 +1,13 @@
import { Authorized, Post, RestController, RequireGlobalScope } from '@/decorators';
import { OrchestrationRequest } from '@/requests';
import { SingleMainSetup } from '@/services/orchestration/main/SingleMainSetup';
import { OrchestrationService } from '@/services/orchestration.service';
import { License } from '@/License';
@Authorized()
@RestController('/orchestration')
export class OrchestrationController {
constructor(
private readonly singleMainSetup: SingleMainSetup,
private readonly orchestrationService: OrchestrationService,
private readonly licenseService: License,
) {}
@@ -20,20 +20,20 @@ export class OrchestrationController {
async getWorkersStatus(req: OrchestrationRequest.Get) {
if (!this.licenseService.isWorkerViewLicensed()) return;
const id = req.params.id;
return await this.singleMainSetup.getWorkerStatus(id);
return await this.orchestrationService.getWorkerStatus(id);
}
@RequireGlobalScope('orchestration:read')
@Post('/worker/status')
async getWorkersStatusAll() {
if (!this.licenseService.isWorkerViewLicensed()) return;
return await this.singleMainSetup.getWorkerStatus();
return await this.orchestrationService.getWorkerStatus();
}
@RequireGlobalScope('orchestration:list')
@Post('/worker/ids')
async getWorkerIdsAll() {
if (!this.licenseService.isWorkerViewLicensed()) return;
return await this.singleMainSetup.getWorkerIds();
return await this.orchestrationService.getWorkerIds();
}
}