From 12c61d9b5dd7c0bbe033ba864d9d6ce8120273c8 Mon Sep 17 00:00:00 2001 From: Rafael Date: Fri, 13 Mar 2026 18:08:39 -0300 Subject: [PATCH] FIX: rename-tables proxy path and ES lookup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix proxy path: /jobs/jdbc/:jobId/rename-tables → /jobs/:jobId/rename-tables - Remove pipeline_id from ES data asset lookup, search by table_name + table_schema only Co-Authored-By: Claude Opus 4.6 --- src/modules/platform-api/platform-api.controller.ts | 4 ++-- src/services/elasticsearch/elasticsearch.service.ts | 9 +++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/modules/platform-api/platform-api.controller.ts b/src/modules/platform-api/platform-api.controller.ts index 97b0a08..31bf1c3 100644 --- a/src/modules/platform-api/platform-api.controller.ts +++ b/src/modules/platform-api/platform-api.controller.ts @@ -1066,8 +1066,8 @@ export class PlatformApiController { const rollbackSteps: Array<() => Promise> = []; try { - const dataAsset = await this.elasticsearchService.findDataAssetByPipelineAndTable( - user.customer_name, pipelineId, oldTableName, oldTableSchema, + const dataAsset = await this.elasticsearchService.findDataAssetByTable( + user.customer_name, oldTableName, oldTableSchema, ); if (!dataAsset) { diff --git a/src/services/elasticsearch/elasticsearch.service.ts b/src/services/elasticsearch/elasticsearch.service.ts index 8fff83e..8e2dfe7 100644 --- a/src/services/elasticsearch/elasticsearch.service.ts +++ b/src/services/elasticsearch/elasticsearch.service.ts @@ -362,9 +362,8 @@ export class ElasticsearchService { return `${customerName}_data_assets_catalog`; } - async findDataAssetByPipelineAndTable( + async findDataAssetByTable( customerName: string, - pipelineId: string, tableName: string, tableSchema: string, ): Promise<{ id: string; nimbus_id: number | null; [key: string]: any } | null> { @@ -372,7 +371,6 @@ export class ElasticsearchService { this.logger.info('Elasticsearch: Searching data asset', { index, - pipelineId, tableName, tableSchema, }); @@ -382,7 +380,6 @@ export class ElasticsearchService { query: { bool: { must: [ - { term: { 'pipeline_id.keyword': pipelineId } }, { term: { 'table_name.keyword': tableName } }, { term: { 'table_schema.keyword': tableSchema } }, ], @@ -393,13 +390,13 @@ export class ElasticsearchService { const hits = response.data.hits?.hits || []; if (hits.length === 0) { - this.logger.warn('Elasticsearch: Data asset not found', { pipelineId, tableName, tableSchema, index }); + this.logger.warn('Elasticsearch: Data asset not found', { tableName, tableSchema, index }); return null; } return { ...hits[0]._source, _es_id: hits[0]._id }; } catch (error) { - this.handleError('findDataAssetByPipelineAndTable', error, { pipelineId, tableName, tableSchema, index }); + this.handleError('findDataAssetByTable', error, { tableName, tableSchema, index }); throw error; } }