From 035213824be554727603fe0bdc131b888d326fda Mon Sep 17 00:00:00 2001 From: "rodrigo.zamboni" Date: Thu, 28 Apr 2022 12:00:19 -0300 Subject: [PATCH 1/4] FIX: fixing missing id on delete routes --- src/modules/catalog/catalog.controller.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index afcf702..003117f 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -72,7 +72,7 @@ export class CatalogController { return res; } - @Delete('table-metadata') + @Delete('table-metadata/:id') async deleteOneTableMetadata(@Param() params, @Body() body) { const { id } = params; console.log(`/catalog`, 'ON DELETE ONE TABLE METADATA ROUTE'); @@ -95,7 +95,7 @@ export class CatalogController { return res; } - @Delete('column-metadata') + @Delete('column-metadata/:id') async deleteOneColumnMetadata(@Param() params, @Body() body) { console.log(`/catalog`, 'ON DELETE ONE COLUMN METADATA ROUTE'); const { id } = params; @@ -252,7 +252,7 @@ export class CatalogController { return res; } - @Delete('table-tags') + @Delete('table-tags/:id') async deleteTableTags(@Param() params, @Body() body) { console.log(`/catalog`, 'ON CREATE TABLE TAGS ROUTE'); const { id } = params; @@ -275,7 +275,7 @@ export class CatalogController { return res; } - @Delete('table-rules') + @Delete('table-rules/:id') async deleteTableRules(@Param() params, @Body() body) { console.log(`/catalog`, 'ON DELETE TABLE RULES ROUTE'); const { id } = params; From 22f493d48ad6e3576665fce147a758631697f5e7 Mon Sep 17 00:00:00 2001 From: "rodrigo.zamboni" Date: Thu, 28 Apr 2022 12:12:37 -0300 Subject: [PATCH 2/4] FIX: fixing missing id on delete routes --- src/modules/catalog/catalog.controller.ts | 14 +++++++------- src/modules/catalog/catalog.service.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index 003117f..a0d4cff 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -33,7 +33,7 @@ export class CatalogController { const { id } = params; const catalogService = new CatalogService(); - const res = await catalogService.dataAppsOne(body, id); + const res = await catalogService.dataAppsOne(id, body); return res; } @@ -56,7 +56,7 @@ export class CatalogController { const catalogService = new CatalogService(); - const res = await catalogService.getOneDashboardMetabase(body, id); + const res = await catalogService.getOneDashboardMetabase(id, body); return res; } @@ -79,7 +79,7 @@ export class CatalogController { const catalogService = new CatalogService(); - const res = await catalogService.deleteOneTableMetadata(body, id); + const res = await catalogService.deleteOneTableMetadata(id, body); return res; } @@ -102,7 +102,7 @@ export class CatalogController { const catalogService = new CatalogService(); - const res = await catalogService.deleteOneColumnMetadata(body, id); + const res = await catalogService.deleteOneColumnMetadata(id, body); return res; } @@ -225,7 +225,7 @@ export class CatalogController { const catalogService = new CatalogService(); - const res = await catalogService.deleteTags(body, id); + const res = await catalogService.deleteTags(id, body); return res; } @@ -259,7 +259,7 @@ export class CatalogController { const catalogService = new CatalogService(); - const res = await catalogService.deleteTableTags(body, id); + const res = await catalogService.deleteTableTags(id, body); return res; } @@ -282,7 +282,7 @@ export class CatalogController { const catalogService = new CatalogService(); - const res = await catalogService.deleteTableRules(body, id); + const res = await catalogService.deleteTableRules(id, body); return res; } diff --git a/src/modules/catalog/catalog.service.ts b/src/modules/catalog/catalog.service.ts index d6b2bad..c91305b 100644 --- a/src/modules/catalog/catalog.service.ts +++ b/src/modules/catalog/catalog.service.ts @@ -51,7 +51,7 @@ class CatalogService { return data; } - async getOneDashboardMetabase(body, id) { + async getOneDashboardMetabase(id, body) { const customer = body.info.customer.toLowerCase() === 'dadosfera' ? `` From c997e9191248ad99b670452b874af1ce4d571a09 Mon Sep 17 00:00:00 2001 From: "rodrigo.zamboni" Date: Thu, 28 Apr 2022 12:59:35 -0300 Subject: [PATCH 3/4] FIX: fix table-metadata find one route --- src/modules/catalog/catalog.controller.ts | 23 +++++++++++++++++------ src/modules/catalog/catalog.service.ts | 13 +++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index a0d4cff..b955139 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -1,4 +1,12 @@ -import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common'; +import { + Body, + Controller, + Delete, + Get, + Param, + Post, + Query, +} from '@nestjs/common'; import { CatalogService } from './catalog.service'; @Controller('catalog') @@ -62,14 +70,17 @@ export class CatalogController { } @Get('table-metadata') - async getAllTableMetadata(@Body() body) { + async getAllTableMetadata(@Body() body, @Query() query) { console.log(`/catalog`, 'ON GET ALL TABLES METADATA ROUTE'); const catalogService = new CatalogService(); - - const res = await catalogService.getAllTableMetadata(body); - - return res; + if (!query) { + const res = await catalogService.getAllTableMetadata(body); + return res; + } else { + const res = await catalogService.getOneTableMetadata(body, query); + return res; + } } @Delete('table-metadata/:id') diff --git a/src/modules/catalog/catalog.service.ts b/src/modules/catalog/catalog.service.ts index c91305b..525e0f1 100644 --- a/src/modules/catalog/catalog.service.ts +++ b/src/modules/catalog/catalog.service.ts @@ -75,6 +75,19 @@ class CatalogService { return data; } + async getOneTableMetadata(body, params) { + const customer = + body.info.customer.toLowerCase() === 'dadosfera' + ? `` + : `-${body.info.customer.toLowerCase()}`; + + const { data } = await axios.get( + `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-metadata/`, + { params: params }, + ); + return data; + } + async deleteOneTableMetadata(id, body) { const customer = body.info.customer.toLowerCase() === 'dadosfera' From 28580782b1f9d185a5c78e2df3bb3f6a5d7bd244 Mon Sep 17 00:00:00 2001 From: "rodrigo.zamboni" Date: Thu, 28 Apr 2022 14:14:03 -0300 Subject: [PATCH 4/4] FIX: catalog routes fix --- src/modules/catalog/catalog.controller.ts | 22 +++++++++++++++++++ src/modules/catalog/catalog.service.ts | 26 +++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/modules/catalog/catalog.controller.ts b/src/modules/catalog/catalog.controller.ts index b955139..aea725c 100644 --- a/src/modules/catalog/catalog.controller.ts +++ b/src/modules/catalog/catalog.controller.ts @@ -173,6 +173,17 @@ export class CatalogController { return res; } + @Post('data-rating') + async createDataRating(@Body() body) { + console.log(`/catalog`, 'ON GET DATA RATING ROUTE'); + + const catalogService = new CatalogService(); + + const res = await catalogService.createDataRating(body); + + return res; + } + @Get('summary-rating/:id') async getSummaryRating(@Param() params, @Body() body) { console.log(`/catalog`, 'ON GET SUMMARY RATING ROUTE'); @@ -196,6 +207,17 @@ export class CatalogController { return res; } + @Post('data-comment') + async createDataComment(@Body() body) { + console.log(`/catalog`, 'ON GET DATA COMMENT ROUTE'); + + const catalogService = new CatalogService(); + + const res = await catalogService.createDataComment(body); + + return res; + } + @Get('data-review') async getDataReview(@Body() body) { console.log(`/catalog`, 'ON GET DATA REVIEW ROUTE'); diff --git a/src/modules/catalog/catalog.service.ts b/src/modules/catalog/catalog.service.ts index 525e0f1..eba07fd 100644 --- a/src/modules/catalog/catalog.service.ts +++ b/src/modules/catalog/catalog.service.ts @@ -184,6 +184,19 @@ class CatalogService { return data; } + async createDataRating(body) { + const customer = + body.info.customer.toLowerCase() === 'dadosfera' + ? `` + : `-${body.info.customer.toLowerCase()}`; + + const { data } = await axios.post( + `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-rating/`, + body, + ); + return data; + } + async getSummaryRating(id, body) { const customer = body.info.customer.toLowerCase() === 'dadosfera' @@ -207,6 +220,19 @@ class CatalogService { return data; } + async createDataComment(body) { + const customer = + body.info.customer.toLowerCase() === 'dadosfera' + ? `` + : `-${body.info.customer.toLowerCase()}`; + + const { data } = await axios.post( + `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-comment/`, + body, + ); + return data; + } + async getDataReview(body) { const customer = body.info.customer.toLowerCase() === 'dadosfera'