Compare commits

...
3 Commits
Author SHA1 Message Date
Rodrigo Zamboni 849b979e63 Merge pull request #81 from dadosfera/feat/CatalogFixes
Feat/catalog fixes
2022-04-28 14:19:31 -03:00
rodrigo.zamboni 28580782b1 FIX: catalog routes fix 2022-04-28 14:14:03 -03:00
rodrigo.zamboni c997e91912 FIX: fix table-metadata find one route 2022-04-28 12:59:35 -03:00
2 changed files with 78 additions and 6 deletions
+39 -6
View File
@@ -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')
@@ -162,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');
@@ -185,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');
+39
View File
@@ -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'
@@ -171,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'
@@ -194,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'