Compare commits

..
8 changed files with 421 additions and 9528 deletions
+16 -9262
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -31,7 +31,7 @@
"@nestjs/platform-express": "^8.4.3",
"@nestjs/schedule": "^1.1.0",
"@nestjs/swagger": "^5.2.1",
"@victorradael/protospack": "^1.8.0",
"@victorradael/protospack": "1.7.4",
"axios": "^0.25.0",
"dotenv": "^14.2.0",
"helmet": "^5.0.2",
+2 -2
View File
@@ -162,11 +162,11 @@ export class AuthClientService implements OnModuleInit {
async resendeConfirmationCode({
username,
}: AuthResendConfirmationCodeRequest): Promise<any> {
console.log('AuthClientService', 'resendConfirmationCode');
console.log('AuthClientService', 'resendeConfirmationCode');
const authResendConfirmationCodeRequestReturn = await new Promise(
(resolve, reject) => {
this.authService.resendConfirmationCode({ username }).subscribe({
this.authService.resendeConfirmationCode({ username }).subscribe({
next(x) {
resolve(x);
},
-26
View File
@@ -1,7 +1,6 @@
import { OnModuleInit, Inject } from '@nestjs/common';
import { ClientGrpc } from '@nestjs/microservices';
import {
InputCreateS3Request,
InputNewCreateRequest,
InputService,
TestConnectionGetColumnsRequest,
@@ -51,31 +50,6 @@ export class InputsClientService implements OnModuleInit {
return createInputResponse;
}
async createS3Inputs(createInputDto: InputCreateS3Request) {
console.log('InputClientService', 'Create');
const createInputResponse = await new Promise((resolve, reject) => {
this.inputService.CreateS3(objectSnakeToCamel(createInputDto)).subscribe({
next(x) {
resolve(objectCamelToSnake(x));
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
});
})
.then((res) => res)
.catch((err) => {
throw new Error(err);
});
return createInputResponse;
}
async findOne(data: IIdRequest) {
console.log('InputClientService', 'FindOne');
+2 -7
View File
@@ -31,7 +31,6 @@ export class LoggerMiddleware implements NestMiddleware {
const jwtDecoded: any = decode(idToken);
const permissions = jwtDecoded.user.permissions;
const clienId = jwtDecoded.user.customerId;
const customer = jwtDecoded.user.customer;
const userId = jwtDecoded.user.id;
@@ -39,20 +38,16 @@ export class LoggerMiddleware implements NestMiddleware {
await verifyToken(accessToken);
let havePermission = false;
const permission = permissions.find((permission) => {
permissions.forEach((permission) => {
permission = permission.split('/');
const method = permission[0].trim();
const route = permission[1].trim();
if (method === requiredMethod && route === requiredRoute) {
return permission;
havePermission = true;
}
});
if (permission) {
havePermission = true;
}
if (havePermission) {
request.body.info = {
customer_id: clienId,
+88 -32
View File
@@ -17,7 +17,9 @@ export class CatalogController {
async catalogAll(@Body() body) {
console.log(`/catalog`, 'ON CATALOG ALL ROUTE');
const res = await this.catalogService.catalogAll(body);
const catalogService = new CatalogService();
const res = await catalogService.catalogAll(body);
return res;
}
@@ -26,7 +28,9 @@ export class CatalogController {
async dataAppsAll(@Body() body) {
console.log(`/catalog`, 'ON FIND ALL DATA APPS ROUTE');
const res = await this.catalogService.dataAppsAll(body);
const catalogService = new CatalogService();
const res = await catalogService.dataAppsAll(body);
return res;
}
@@ -35,8 +39,9 @@ export class CatalogController {
async dataAppsOne(@Param() params, @Body() body) {
console.log(`/catalog`, 'ON FIND ONE DATA APP ROUTE');
const { id } = params;
const catalogService = new CatalogService();
const res = await this.catalogService.dataAppsOne(id, body);
const res = await catalogService.dataAppsOne(id, body);
return res;
}
@@ -45,7 +50,9 @@ export class CatalogController {
async getAllDashboardMetabase(@Body() body) {
console.log(`/catalog`, 'ON GET ALL DASHBOARDS METABASE ROUTE');
const res = await this.catalogService.getAllDashboardMetabase(body);
const catalogService = new CatalogService();
const res = await catalogService.getAllDashboardMetabase(body);
return res;
}
@@ -55,7 +62,9 @@ export class CatalogController {
const { id } = params;
console.log(`/catalog`, 'ON GET ONE DASHBOARD METABASE ROUTE');
const res = await this.catalogService.getOneDashboardMetabase(id, body);
const catalogService = new CatalogService();
const res = await catalogService.getOneDashboardMetabase(id, body);
return res;
}
@@ -64,11 +73,12 @@ export class CatalogController {
async getAllTableMetadata(@Body() body, @Query() query) {
console.log(`/catalog`, 'ON GET ALL TABLES METADATA ROUTE');
const catalogService = new CatalogService();
if (!query) {
const res = await this.catalogService.getAllTableMetadata(body);
const res = await catalogService.getAllTableMetadata(body);
return res;
} else {
const res = await this.catalogService.getOneTableMetadata(body, query);
const res = await catalogService.getOneTableMetadata(body, query);
return res;
}
}
@@ -78,7 +88,9 @@ export class CatalogController {
const { id } = params;
console.log(`/catalog`, 'ON DELETE ONE TABLE METADATA ROUTE');
const res = await this.catalogService.deleteOneTableMetadata(id, body);
const catalogService = new CatalogService();
const res = await catalogService.deleteOneTableMetadata(id, body);
return res;
}
@@ -87,7 +99,9 @@ export class CatalogController {
async getOneColumnMetadata(@Body() body, @Query() params) {
console.log(`/catalog`, 'ON GET ONE COLUMN METADATA ROUTE');
const res = await this.catalogService.getOneColumnMetadata(body, params);
const catalogService = new CatalogService();
const res = await catalogService.getOneColumnMetadata(body, params);
return res;
}
@@ -97,7 +111,9 @@ export class CatalogController {
console.log(`/catalog`, 'ON DELETE ONE COLUMN METADATA ROUTE');
const { id } = params;
const res = await this.catalogService.deleteOneColumnMetadata(id, body);
const catalogService = new CatalogService();
const res = await catalogService.deleteOneColumnMetadata(id, body);
return res;
}
@@ -106,7 +122,9 @@ export class CatalogController {
async getOneDataPreview(@Body() body, @Query() params) {
console.log(`/catalog`, 'ON GET ONE DATAPREVIEW ROUTE');
const res = await this.catalogService.getOneDataPreview(body, params);
const catalogService = new CatalogService();
const res = await catalogService.getOneDataPreview(body, params);
return res;
}
@@ -115,7 +133,9 @@ export class CatalogController {
async getDataStatus(@Body() body) {
console.log(`/catalog`, 'ON GET DATA STATUS ROUTE');
const res = await this.catalogService.getDataStatus(body);
const catalogService = new CatalogService();
const res = await catalogService.getDataStatus(body);
return res;
}
@@ -124,7 +144,9 @@ export class CatalogController {
async createDataStatus(@Body() body) {
console.log(`/catalog`, 'ON CREATE DATA STATUS ROUTE');
const res = await this.catalogService.createDataStatus(body);
const catalogService = new CatalogService();
const res = await catalogService.createDataStatus(body);
return res;
}
@@ -133,7 +155,9 @@ export class CatalogController {
async getDataDescription(@Body() body) {
console.log(`/catalog`, 'ON GET DATA DESCRIPTION ROUTE');
const res = await this.catalogService.getDataDescription(body);
const catalogService = new CatalogService();
const res = await catalogService.getDataDescription(body);
return res;
}
@@ -142,7 +166,9 @@ export class CatalogController {
async createDataDescription(@Body() body) {
console.log(`/catalog`, 'ON CREATE DATA DESCRIPTION ROUTE');
const res = await this.catalogService.createDataDescription(body);
const catalogService = new CatalogService();
const res = await catalogService.createDataDescription(body);
return res;
}
@@ -151,7 +177,9 @@ export class CatalogController {
async getDataDocs(@Body() body) {
console.log(`/catalog`, 'ON GET DATA DOCS ROUTE');
const res = await this.catalogService.getDataDocs(body);
const catalogService = new CatalogService();
const res = await catalogService.getDataDocs(body);
return res;
}
@@ -160,7 +188,9 @@ export class CatalogController {
async createDataDocs(@Body() body) {
console.log(`/catalog`, 'ON CREATE DATA DOCS ROUTE');
const res = await this.catalogService.createDataDocs(body);
const catalogService = new CatalogService();
const res = await catalogService.createDataDocs(body);
return res;
}
@@ -169,7 +199,9 @@ export class CatalogController {
async getDataRating(@Body() body) {
console.log(`/catalog`, 'ON GET DATA RATING ROUTE');
const res = await this.catalogService.getDataRating(body);
const catalogService = new CatalogService();
const res = await catalogService.getDataRating(body);
return res;
}
@@ -178,7 +210,9 @@ export class CatalogController {
async createDataRating(@Body() body) {
console.log(`/catalog`, 'ON GET DATA RATING ROUTE');
const res = await this.catalogService.createDataRating(body);
const catalogService = new CatalogService();
const res = await catalogService.createDataRating(body);
return res;
}
@@ -188,9 +222,9 @@ export class CatalogController {
console.log(`/catalog`, 'ON GET SUMMARY RATING ROUTE');
//const { id } = params;
//
//const catalogService = new CatalogService();
//const res = await this.catalogService.getSummaryRating(id, body);
//const res = await catalogService.getSummaryRating(id, body);
return {
avg_rating: 0,
@@ -202,7 +236,9 @@ export class CatalogController {
async getDataComment(@Body() body) {
console.log(`/catalog`, 'ON GET DATA COMMENT ROUTE');
const res = await this.catalogService.getDataComment(body);
const catalogService = new CatalogService();
const res = await catalogService.getDataComment(body);
return res;
}
@@ -211,7 +247,9 @@ export class CatalogController {
async createDataComment(@Body() body) {
console.log(`/catalog`, 'ON GET DATA COMMENT ROUTE');
const res = await this.catalogService.createDataComment(body);
const catalogService = new CatalogService();
const res = await catalogService.createDataComment(body);
return res;
}
@@ -220,7 +258,9 @@ export class CatalogController {
async getDataReview(@Body() body, @Query() params) {
console.log(`/catalog`, 'ON GET DATA REVIEW ROUTE');
const res = await this.catalogService.getDataReview(body, params);
const catalogService = new CatalogService();
const res = await catalogService.getDataReview(body, params);
return res;
}
@@ -229,7 +269,9 @@ export class CatalogController {
async createTags(@Body() body) {
console.log(`/catalog`, 'ON CREATE TAG ROUTE');
const res = await this.catalogService.createTags(body);
const catalogService = new CatalogService();
const res = await catalogService.createTags(body);
return res;
}
@@ -238,7 +280,9 @@ export class CatalogController {
async findAllTags(@Body() body) {
console.log(`/catalog`, 'ON FIND ALL TAGS ROUTE');
const res = await this.catalogService.findAllTags(body);
const catalogService = new CatalogService();
const res = await catalogService.findAllTags(body);
return res;
}
@@ -248,7 +292,9 @@ export class CatalogController {
console.log(`/catalog`, 'ON DELETE TAG ROUTE');
const { id } = params;
const res = await this.catalogService.deleteTags(id, body);
const catalogService = new CatalogService();
const res = await catalogService.deleteTags(id, body);
return res;
}
@@ -257,7 +303,9 @@ export class CatalogController {
async createTableTags(@Body() body) {
console.log(`/catalog`, 'ON CREATE TABLE TAG ROUTE');
const res = await this.catalogService.createTableTags(body);
const catalogService = new CatalogService();
const res = await catalogService.createTableTags(body);
return res;
}
@@ -266,7 +314,9 @@ export class CatalogController {
async getAllTableTags(@Body() body) {
console.log(`/catalog`, 'ON GET ALL TABLE TAGS ROUTE');
const res = await this.catalogService.findAllTableTags(body);
const catalogService = new CatalogService();
const res = await catalogService.findAllTableTags(body);
return res;
}
@@ -276,7 +326,9 @@ export class CatalogController {
console.log(`/catalog`, 'ON CREATE TABLE TAGS ROUTE');
const { id } = params;
const res = await this.catalogService.deleteTableTags(id, body);
const catalogService = new CatalogService();
const res = await catalogService.deleteTableTags(id, body);
return res;
}
@@ -285,7 +337,9 @@ export class CatalogController {
async getTableRules(@Body() body) {
console.log(`/catalog`, 'ON GET TABLE RULES ROUTE');
const res = await this.catalogService.getTableRules(body);
const catalogService = new CatalogService();
const res = await catalogService.getTableRules(body);
return res;
}
@@ -295,7 +349,9 @@ export class CatalogController {
console.log(`/catalog`, 'ON DELETE TABLE RULES ROUTE');
const { id } = params;
const res = await this.catalogService.deleteTableRules(id, body);
const catalogService = new CatalogService();
const res = await catalogService.deleteTableRules(id, body);
return res;
}
+307 -186
View File
@@ -2,12 +2,15 @@ import axios from 'axios';
class CatalogService {
async catalogAll(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(`${nimbusUrl}/api/catalog/all/`);
@@ -15,24 +18,30 @@ class CatalogService {
}
async dataAppsAll(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data_apps/`);
return data;
}
async dataAppsOne(id, body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/data_apps/${id}/`,
@@ -42,12 +51,16 @@ class CatalogService {
}
async getAllDashboardMetabase(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/dashboard-metabase/`,
);
@@ -55,12 +68,16 @@ class CatalogService {
}
async getOneDashboardMetabase(id, body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/dashboard-metabase/${id}`,
);
@@ -74,12 +91,16 @@ class CatalogService {
}
async getAllTableMetadata(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/table-metadata/`,
);
@@ -87,12 +108,16 @@ class CatalogService {
}
async getOneTableMetadata(body, params) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/table-metadata/`,
{ params: params },
@@ -101,12 +126,16 @@ class CatalogService {
}
async deleteOneTableMetadata(id, body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.delete(
`${nimbusUrl}/api/catalog/table-metadata/${id}`,
);
@@ -114,12 +143,16 @@ class CatalogService {
}
async getOneColumnMetadata(body, params) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/column-metadata/`,
{ params: params },
@@ -128,12 +161,16 @@ class CatalogService {
}
async deleteOneColumnMetadata(id, body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.delete(
`${nimbusUrl}/api/catalog/column-metadata/${id}/`,
);
@@ -141,12 +178,16 @@ class CatalogService {
}
async getOneDataPreview(body, params) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-preview/`, {
params: params,
});
@@ -154,23 +195,31 @@ class CatalogService {
}
async getDataStatus(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-status/`);
return data;
}
async createDataStatus(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.post(
`${nimbusUrl}/api/catalog/data-status/`,
body,
@@ -179,12 +228,16 @@ class CatalogService {
}
async getDataDescription(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/data-description/`,
);
@@ -192,12 +245,16 @@ class CatalogService {
}
async createDataDescription(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.post(
`${nimbusUrl}/api/catalog/data-description/`,
body,
@@ -206,23 +263,31 @@ class CatalogService {
}
async getDataDocs(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-docs/`);
return data;
}
async createDataDocs(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.post(
`${nimbusUrl}/api/catalog/data-docs/`,
body,
@@ -231,23 +296,31 @@ class CatalogService {
}
async getDataRating(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-rating/`);
return data;
}
async createDataRating(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.post(
`${nimbusUrl}/api/catalog/data-rating/`,
body,
@@ -256,12 +329,16 @@ class CatalogService {
}
async getSummaryRating(id, body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/summary-rating/${id}`,
);
@@ -269,23 +346,31 @@ class CatalogService {
}
async getDataComment(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-comment/`);
return data;
}
async createDataComment(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.post(
`${nimbusUrl}/api/catalog/data-comment/`,
body,
@@ -294,12 +379,16 @@ class CatalogService {
}
async getDataReview(body, params) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(`${nimbusUrl}/api/catalog/data-review/`, {
params: params,
});
@@ -307,34 +396,46 @@ class CatalogService {
}
async createTags(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.post(`${nimbusUrl}/api/catalog/tags/`, body);
return data;
}
async findAllTags(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(`${nimbusUrl}/api/catalog/tags/`, body);
return data;
}
async findAllTableTags(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/table-tags/`,
body,
@@ -343,23 +444,31 @@ class CatalogService {
}
async deleteTags(id, body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.delete(`${nimbusUrl}/api/catalog/tags/${id}`);
return data;
}
async createTableTags(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.post(
`${nimbusUrl}/api/catalog/table-tags/`,
body,
@@ -368,12 +477,16 @@ class CatalogService {
}
async deleteTableTags(id, body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.delete(
`${nimbusUrl}/api/catalog/table-tags/${id}`,
);
@@ -381,12 +494,16 @@ class CatalogService {
}
async getTableRules(body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/table-rules/`,
body,
@@ -395,12 +512,16 @@ class CatalogService {
}
async deleteTableRules(id, body) {
let nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`;
if (process.env.ENV !== 'prd') {
nimbusUrl = `https://nimbus-${body.info.customer.toLowerCase()}.${
process.env.ENV
}.dadosfera.ai`;
}
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
? ``
: `-${body.info.customer.toLowerCase()}`;
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.delete(
`${nimbusUrl}/api/catalog/table-rules/${id}`,
);
+5 -12
View File
@@ -1,5 +1,6 @@
import { Body, HttpException, HttpStatus, Injectable } from '@nestjs/common';
import { Timeout } from '@nestjs/schedule';
import { InputNewCreateRequest } from '@victorradael/protospack';
import { InputsClientService } from 'src/clients/inputs/client.service';
import { IIdRequest, Info } from 'src/clients/inputs/interfaces';
@@ -7,19 +8,11 @@ import { IIdRequest, Info } from 'src/clients/inputs/interfaces';
export class InputsService {
constructor(private inputClient: InputsClientService) {}
async create(@Body() data) {
async create(@Body() data: InputNewCreateRequest) {
try {
if (
data.plugin == 'csv' ||
data.plugin == 'json' ||
data.plugin == 'parquet'
) {
const createInputResponse = await this.inputClient.createS3Inputs(data);
return createInputResponse;
} else {
const createInputResponse = await this.inputClient.create(data);
return createInputResponse;
}
const createInputResponse = await this.inputClient.create(data);
return createInputResponse;
} catch (err) {
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
}