mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-29 02:24:49 +00:00
FEAT: refine PipelineTablesConfig type definition and update parsing logic in PipelinesController
This commit is contained in:
@@ -54,6 +54,9 @@ import { TableColumns } from '../inputs/dtos/input.model';
|
||||
import { UpdateInputRequest } from '../inputs/dtos/old_interfaces';
|
||||
import { Info } from '@dadosfera/protospack-v2/dist/lib/Input/interfaces/entities';
|
||||
|
||||
type PipelineTable = { name: string; job_id?: string; is_deleted?: boolean; [key: string]: any };
|
||||
type PipelineTablesConfig = { input_id?: string; tables?: PipelineTable[] } | PipelineTable[];
|
||||
|
||||
@ApiTags('PipelinesV2')
|
||||
@ApiHeaders([{ name: 'dadosfera-lang', enum: LanguageEnum, required: false }])
|
||||
@UseFilters(new GrpcToHttpExceptionFilter())
|
||||
@@ -63,6 +66,7 @@ export class PipelinesController {
|
||||
constructor(
|
||||
@Inject(DadosferaLogger)
|
||||
dadosferaLogger: DadosferaLogger,
|
||||
|
||||
private pipelinesClientService: PipelinesService,
|
||||
private oldPipelinesService: OldPipelineService,
|
||||
private platformApiService: PlatformApiService,
|
||||
@@ -229,11 +233,9 @@ export class PipelinesController {
|
||||
this.platformApiService.proxy('GET', `/pipeline/${id.replace(/-/g, '_')}`, user).catch(() => null),
|
||||
]);
|
||||
|
||||
//{pipeline:{tables: {tables: [], input_id: ''}}}
|
||||
type PipelineTablesConfig = { input_id?: string; tables?: Array<{ name: string }> } | Array<{ name: string }>;
|
||||
const parsed: PipelineTablesConfig = JSON.parse(pipelineRes.pipeline.config.tables);
|
||||
const input_id = (parsed as { input_id?: string })?.input_id;
|
||||
let tables: Array<any> = (parsed as { tables?: Array<any> })?.tables ?? (parsed as Array<any>);
|
||||
const input_id = (parsed as { input_id?: string; tables?: PipelineTable[] })?.input_id;
|
||||
let tables: PipelineTable[] = (parsed as { tables?: PipelineTable[] })?.tables ?? (parsed as PipelineTable[]);
|
||||
|
||||
if (platformPipeline?.jobs?.length) {
|
||||
tables = tables.map((table) => {
|
||||
|
||||
Reference in New Issue
Block a user