Compare commits

...
9 Commits
3 changed files with 91 additions and 19 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
<p align="center"> <p align="center">
<image src="./assets/maestro.svg" style="width:10rem"> <image src="./assets/maestro.svg" style="width:10rem">
<h1 align="center">Maestro</h1> <h1 align="center">Maestro</h1>
</p> </p>
+50 -17
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'; import { CatalogService } from './catalog.service';
@Controller('catalog') @Controller('catalog')
@@ -33,7 +41,7 @@ export class CatalogController {
const { id } = params; const { id } = params;
const catalogService = new CatalogService(); const catalogService = new CatalogService();
const res = await catalogService.dataAppsOne(body, id); const res = await catalogService.dataAppsOne(id, body);
return res; return res;
} }
@@ -56,30 +64,33 @@ export class CatalogController {
const catalogService = new CatalogService(); const catalogService = new CatalogService();
const res = await catalogService.getOneDashboardMetabase(body, id); const res = await catalogService.getOneDashboardMetabase(id, body);
return res; return res;
} }
@Get('table-metadata') @Get('table-metadata')
async getAllTableMetadata(@Body() body) { async getAllTableMetadata(@Body() body, @Query() query) {
console.log(`/catalog`, 'ON GET ALL TABLES METADATA ROUTE'); console.log(`/catalog`, 'ON GET ALL TABLES METADATA ROUTE');
const catalogService = new CatalogService(); const catalogService = new CatalogService();
if (!query) {
const res = await catalogService.getAllTableMetadata(body); const res = await catalogService.getAllTableMetadata(body);
return res;
return res; } else {
const res = await catalogService.getOneTableMetadata(body, query);
return res;
}
} }
@Delete('table-metadata') @Delete('table-metadata/:id')
async deleteOneTableMetadata(@Param() params, @Body() body) { async deleteOneTableMetadata(@Param() params, @Body() body) {
const { id } = params; const { id } = params;
console.log(`/catalog`, 'ON DELETE ONE TABLE METADATA ROUTE'); console.log(`/catalog`, 'ON DELETE ONE TABLE METADATA ROUTE');
const catalogService = new CatalogService(); const catalogService = new CatalogService();
const res = await catalogService.deleteOneTableMetadata(body, id); const res = await catalogService.deleteOneTableMetadata(id, body);
return res; return res;
} }
@@ -95,14 +106,14 @@ export class CatalogController {
return res; return res;
} }
@Delete('column-metadata') @Delete('column-metadata/:id')
async deleteOneColumnMetadata(@Param() params, @Body() body) { async deleteOneColumnMetadata(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON DELETE ONE COLUMN METADATA ROUTE'); console.log(`/catalog`, 'ON DELETE ONE COLUMN METADATA ROUTE');
const { id } = params; const { id } = params;
const catalogService = new CatalogService(); const catalogService = new CatalogService();
const res = await catalogService.deleteOneColumnMetadata(body, id); const res = await catalogService.deleteOneColumnMetadata(id, body);
return res; return res;
} }
@@ -162,6 +173,17 @@ export class CatalogController {
return res; 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') @Get('summary-rating/:id')
async getSummaryRating(@Param() params, @Body() body) { async getSummaryRating(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON GET SUMMARY RATING ROUTE'); console.log(`/catalog`, 'ON GET SUMMARY RATING ROUTE');
@@ -185,6 +207,17 @@ export class CatalogController {
return res; 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') @Get('data-review')
async getDataReview(@Body() body) { async getDataReview(@Body() body) {
console.log(`/catalog`, 'ON GET DATA REVIEW ROUTE'); console.log(`/catalog`, 'ON GET DATA REVIEW ROUTE');
@@ -225,7 +258,7 @@ export class CatalogController {
const catalogService = new CatalogService(); const catalogService = new CatalogService();
const res = await catalogService.deleteTags(body, id); const res = await catalogService.deleteTags(id, body);
return res; return res;
} }
@@ -252,14 +285,14 @@ export class CatalogController {
return res; return res;
} }
@Delete('table-tags') @Delete('table-tags/:id')
async deleteTableTags(@Param() params, @Body() body) { async deleteTableTags(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON CREATE TABLE TAGS ROUTE'); console.log(`/catalog`, 'ON CREATE TABLE TAGS ROUTE');
const { id } = params; const { id } = params;
const catalogService = new CatalogService(); const catalogService = new CatalogService();
const res = await catalogService.deleteTableTags(body, id); const res = await catalogService.deleteTableTags(id, body);
return res; return res;
} }
@@ -275,14 +308,14 @@ export class CatalogController {
return res; return res;
} }
@Delete('table-rules') @Delete('table-rules/:id')
async deleteTableRules(@Param() params, @Body() body) { async deleteTableRules(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON DELETE TABLE RULES ROUTE'); console.log(`/catalog`, 'ON DELETE TABLE RULES ROUTE');
const { id } = params; const { id } = params;
const catalogService = new CatalogService(); const catalogService = new CatalogService();
const res = await catalogService.deleteTableRules(body, id); const res = await catalogService.deleteTableRules(id, body);
return res; return res;
} }
+40 -1
View File
@@ -51,7 +51,7 @@ class CatalogService {
return data; return data;
} }
async getOneDashboardMetabase(body, id) { async getOneDashboardMetabase(id, body) {
const customer = const customer =
body.info.customer.toLowerCase() === 'dadosfera' body.info.customer.toLowerCase() === 'dadosfera'
? `` ? ``
@@ -75,6 +75,19 @@ class CatalogService {
return data; 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) { async deleteOneTableMetadata(id, body) {
const customer = const customer =
body.info.customer.toLowerCase() === 'dadosfera' body.info.customer.toLowerCase() === 'dadosfera'
@@ -171,6 +184,19 @@ class CatalogService {
return data; 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) { async getSummaryRating(id, body) {
const customer = const customer =
body.info.customer.toLowerCase() === 'dadosfera' body.info.customer.toLowerCase() === 'dadosfera'
@@ -194,6 +220,19 @@ class CatalogService {
return data; 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) { async getDataReview(body) {
const customer = const customer =
body.info.customer.toLowerCase() === 'dadosfera' body.info.customer.toLowerCase() === 'dadosfera'