feat: Return scopes on executions (no-changelog) (#10310)

This commit is contained in:
Val
2024-08-07 10:19:09 +01:00
committed by GitHub
parent 6d8323fade
commit fa17391dbd
10 changed files with 94 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
import { ExecutionRequest } from './execution.types';
import { ExecutionRequest, type ExecutionSummaries } from './execution.types';
import { ExecutionService } from './execution.service';
import { Get, Post, RestController } from '@/decorators';
import { EnterpriseExecutionsService } from './execution.service.ee';
@@ -53,10 +53,20 @@ export class ExecutionsController {
const noRange = !query.range.lastId || !query.range.firstId;
if (noStatus && noRange) {
return await this.executionService.findLatestCurrentAndCompleted(query);
const executions = await this.executionService.findLatestCurrentAndCompleted(query);
await this.executionService.addScopes(
req.user,
executions.results as ExecutionSummaries.ExecutionSummaryWithScopes[],
);
return executions;
}
return await this.executionService.findRangeWithCount(query);
const executions = await this.executionService.findRangeWithCount(query);
await this.executionService.addScopes(
req.user,
executions.results as ExecutionSummaries.ExecutionSummaryWithScopes[],
);
return executions;
}
@Get('/:id')