Compare commits

...
2 changed files with 38 additions and 6 deletions
+14 -2
View File
@@ -4574,6 +4574,7 @@
"get": { "get": {
"operationId": "PlatformApiController_getPipelineRunJobs", "operationId": "PlatformApiController_getPipelineRunJobs",
"summary": "Get pipeline run jobs", "summary": "Get pipeline run jobs",
"description": "Proxies platform-api DB-backed job runs and returns `{ jobs: [...] }`.",
"parameters": [ "parameters": [
{ {
"name": "pipelineId", "name": "pipelineId",
@@ -4594,11 +4595,22 @@
], ],
"responses": { "responses": {
"200": { "200": {
"description": "", "description": "DB-backed job runs for the selected pipeline run.",
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"type": "object" "type": "object",
"properties": {
"jobs": {
"type": "array",
"items": {
"type": "object"
}
}
},
"required": [
"jobs"
]
} }
} }
} }
@@ -14,7 +14,7 @@ import {
NotFoundException, NotFoundException,
UseGuards, UseGuards,
} from '@nestjs/common'; } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger'; import { ApiTags, ApiOperation, ApiOkResponse } from '@nestjs/swagger';
import { DadosferaLogger } from '@dadosfera/dadosfera-logs'; import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
import { import {
@@ -72,6 +72,10 @@ export class PlatformApiController {
return id?.replace(/-/g, '_') || ''; return id?.replace(/-/g, '_') || '';
} }
private decodePathParam(value: string): string {
return value ? decodeURIComponent(value) : '';
}
/** /**
* Denormalize ID back to UUID format (replace _ with -). * Denormalize ID back to UUID format (replace _ with -).
* Used when we receive a normalized ID but need the original UUID. * Used when we receive a normalized ID but need the original UUID.
@@ -833,7 +837,23 @@ export class PlatformApiController {
} }
@Get('pipelines/:pipelineId/pipeline_run/:runId/jobs') @Get('pipelines/:pipelineId/pipeline_run/:runId/jobs')
@ApiOperation({ summary: 'Get pipeline run jobs' }) @ApiOperation({
summary: 'Get pipeline run jobs',
description: 'Proxies platform-api DB-backed job runs and returns `{ jobs: [...] }`.',
})
@ApiOkResponse({
description: 'DB-backed job runs for the selected pipeline run.',
schema: {
type: 'object',
properties: {
jobs: {
type: 'array',
items: { type: 'object' },
},
},
required: ['jobs'],
},
})
@RequireAllPermissions(PERMISSIONS_GROUPS.PIPELINE.permissions.GET) @RequireAllPermissions(PERMISSIONS_GROUPS.PIPELINE.permissions.GET)
async getPipelineRunJobs( async getPipelineRunJobs(
@Param('pipelineId') pipelineId: string, @Param('pipelineId') pipelineId: string,
@@ -841,11 +861,11 @@ export class PlatformApiController {
@User() user: RequestUser, @User() user: RequestUser,
) { ) {
const normalizedPipelineId = this.normalizePipelineId(pipelineId); const normalizedPipelineId = this.normalizePipelineId(pipelineId);
const normalizedRunId = this.normalizePipelineId(runId); const decodedRunId = this.decodePathParam(runId);
return this.platformApiService.proxy( return this.platformApiService.proxy(
'GET', 'GET',
`/pipeline/${normalizedPipelineId}/pipeline_run/${normalizedRunId}/jobs`, `/pipeline/${normalizedPipelineId}/pipeline_run/${decodedRunId}/jobs`,
user, user,
); );
} }