diff --git a/src/clients/pipelines/client.service.ts b/src/clients/pipelines/client.service.ts index fe46ea7..70f7583 100644 --- a/src/clients/pipelines/client.service.ts +++ b/src/clients/pipelines/client.service.ts @@ -186,18 +186,27 @@ export class PipelinesClientService implements OnModuleInit { console.log('PipelinesClientService', 'GetPipelineStatus'); const statusPipelineResponse = await new Promise((resolve, reject) => { - this.pipelineService.getPipelineStatus(data).subscribe({ - next(x) { - resolve(x); - }, - error(err) { - console.log('Observable Error'); - reject(err); - }, - complete() { - console.log('done'); - }, - }); + this.pipelineService + .getPipelineStatus(objectSnakeToCamel(data)) + .subscribe({ + next(x) { + const statusArray = x.status.sort((a, b) => { + if (Date.parse(a.updated_at) < Date.parse(b.updated_at)) { + return 1; + } else { + return -1; + } + }); + resolve(statusArray); + }, + error(err) { + console.log('Observable Error'); + reject(err); + }, + complete() { + console.log('done'); + }, + }); }) .then((res) => res) .catch((err) => { diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index aea725c..39a281f 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -96,12 +96,12 @@ export class CatalogController { } @Get('column-metadata') - async getOneColumnMetadata(@Body() body) { + async getOneColumnMetadata(@Body() body, @Query() params) { console.log(`/catalog`, 'ON GET ONE COLUMN METADATA ROUTE'); const catalogService = new CatalogService(); - const res = await catalogService.getOneColumnMetadata(body); + const res = await catalogService.getOneColumnMetadata(body, params); return res; } @@ -119,12 +119,12 @@ export class CatalogController { } @Get('data-preview') - async getOneDataPreview(@Body() body) { + async getOneDataPreview(@Body() body, @Query() params) { console.log(`/catalog`, 'ON GET ONE DATAPREVIEW ROUTE'); const catalogService = new CatalogService(); - const res = await catalogService.getOneDataPreview(body); + const res = await catalogService.getOneDataPreview(body, params); return res; } @@ -219,12 +219,12 @@ export class CatalogController { } @Get('data-review') - async getDataReview(@Body() body) { + async getDataReview(@Body() body, @Query() params) { console.log(`/catalog`, 'ON GET DATA REVIEW ROUTE'); const catalogService = new CatalogService(); - const res = await catalogService.getDataReview(body); + const res = await catalogService.getDataReview(body, params); return res; } diff --git a/src/modules/catalog/catalog.service.ts b/src/modules/catalog/catalog.service.ts index 131d85e..2ccabf6 100644 --- a/src/modules/catalog/catalog.service.ts +++ b/src/modules/catalog/catalog.service.ts @@ -105,7 +105,7 @@ class CatalogService { return data; } - async getOneColumnMetadata(body) { + async getOneColumnMetadata(body, params) { const customer = body.info.customer.toLowerCase() === 'dadosfera' ? `` @@ -113,6 +113,7 @@ class CatalogService { const { data } = await axios.get( `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/column-metadata/`, + { params: params }, ); return data; } @@ -129,7 +130,7 @@ class CatalogService { return data; } - async getOneDataPreview(body) { + async getOneDataPreview(body, params) { const customer = body.info.customer.toLowerCase() === 'dadosfera' ? `` @@ -137,6 +138,7 @@ class CatalogService { const { data } = await axios.get( `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-preview/`, + { params: params }, ); return data; } @@ -238,7 +240,7 @@ class CatalogService { return data; } - async getDataReview(body) { + async getDataReview(body, params) { const customer = body.info.customer.toLowerCase() === 'dadosfera' ? `` @@ -246,6 +248,7 @@ class CatalogService { const { data } = await axios.get( `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-review/`, + { params: params }, ); return data; }