Compare commits

...
14 Commits
12 changed files with 9413 additions and 40 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
<p align="center">
<image src="./assets/maestro.svg" style="width:10rem">
<h1 align="center">Maestro</h1>
</p>
</p>
+9292 -16
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -29,8 +29,9 @@
"@nestjs/mapped-types": "*",
"@nestjs/microservices": "^8.4.3",
"@nestjs/platform-express": "^8.4.3",
"@nestjs/schedule": "^1.1.0",
"@nestjs/swagger": "^5.2.1",
"@victorradael/protospack": "^1.6.1",
"@victorradael/protospack": "^1.6.5",
"axios": "^0.25.0",
"dotenv": "^14.2.0",
"helmet": "^5.0.2",
+2 -2
View File
@@ -20,11 +20,11 @@ export class AuthClientService implements OnModuleInit {
);
}
async signIn({ username, password }: ILogin): Promise<any> {
async signIn({ username, password, totp }: ILogin): Promise<any> {
console.log('AuthClientService', 'SignIn');
const tokens = await new Promise((resolve, reject) => {
this.authService.signIn({ username, password }).subscribe({
this.authService.signIn({ username, password, totp }).subscribe({
next(x) {
resolve(x);
},
+1
View File
@@ -1,4 +1,5 @@
export interface ILogin {
username: string;
password: string;
totp: string;
}
+1 -1
View File
@@ -10,7 +10,7 @@ export class TransformationsClientConfiguration {
return {
transport: Transport.GRPC,
options: {
url: process.env.TRFACTORY_URL,
url: process.env.INFACTORY_URL,
package: TransformationPackages,
credentials: credentials.createSsl(),
protoPath: TransformationProtoFilePath,
+4 -2
View File
@@ -17,9 +17,11 @@ export class LoggerMiddleware implements NestMiddleware {
const idToken = request.get('Dadosfera-User');
const accessToken = request.get('Authorization');
const privateKey = process.env.JWT_PRIVATE_KEY;
let requiredRoute = '';
const requiredMethod = request.method.trim();
const requiredRoute = request.route.path.split('/')[1].trim();
if (request.route.path.split('/').length >= 2) {
requiredRoute = request.route.path.split('/')[1].trim();
}
verify(idToken, privateKey, (err) => {
if (err) {
+3 -2
View File
@@ -5,6 +5,7 @@ import { AuthClientService } from 'src/clients/auth/client.service';
interface ISignIn {
username: string;
password: string;
totp: string;
}
@Controller('auth')
@@ -12,11 +13,11 @@ export class AuthController {
constructor(private authClient: AuthClientService) {}
@Post()
async signIn(@Body() { username, password }: ISignIn) {
async signIn(@Body() { username, password, totp }: ISignIn) {
console.log(`/auth`, 'SignIn');
const tokens = await this.authClient
.signIn({ username, password })
.signIn({ username, password, totp })
.then((result) => result)
.catch((err) => {
throw new UnauthorizedException(err.message);
+41 -5
View File
@@ -140,6 +140,17 @@ export class CatalogController {
return res;
}
@Get('data-status')
async createDataStatus(@Body() body) {
console.log(`/catalog`, 'ON CREATE DATA STATUS ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.createDataStatus(body);
return res;
}
@Get('data-description')
async getDataDescription(@Body() body) {
console.log(`/catalog`, 'ON GET DATA DESCRIPTION ROUTE');
@@ -151,6 +162,17 @@ export class CatalogController {
return res;
}
@Post('data-description')
async createDataDescription(@Body() body) {
console.log(`/catalog`, 'ON CREATE DATA DESCRIPTION ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.createDataDescription(body);
return res;
}
@Get('data-docs')
async getDataDocs(@Body() body) {
console.log(`/catalog`, 'ON GET DATA DOCS ROUTE');
@@ -162,6 +184,17 @@ export class CatalogController {
return res;
}
@Post('data-docs')
async createDataDocs(@Body() body) {
console.log(`/catalog`, 'ON CREATE DATA DOCS ROUTE');
const catalogService = new CatalogService();
const res = await catalogService.createDataDocs(body);
return res;
}
@Get('data-rating')
async getDataRating(@Body() body) {
console.log(`/catalog`, 'ON GET DATA RATING ROUTE');
@@ -185,15 +218,18 @@ export class CatalogController {
}
@Get('summary-rating/:id')
async getSummaryRating(@Param() params, @Body() body) {
async getSummaryRating() {
console.log(`/catalog`, 'ON GET SUMMARY RATING ROUTE');
const { id } = params;
//const { id } = params;
const catalogService = new CatalogService();
//const catalogService = new CatalogService();
const res = await catalogService.getSummaryRating(id, body);
//const res = await catalogService.getSummaryRating(id, body);
return res;
return {
avg_rating: 0,
rating_count: 0,
};
}
@Get('data-comment')
+63 -9
View File
@@ -136,7 +136,7 @@ class CatalogService {
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
const { data } = await axios.delete(
`${nimbusUrl}/api/catalog/table-metadata/${id}`,
);
return data;
@@ -171,7 +171,7 @@ class CatalogService {
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
const { data } = await axios.delete(
`${nimbusUrl}/api/catalog/column-metadata/${id}/`,
);
return data;
@@ -209,6 +209,24 @@ class CatalogService {
return data;
}
async createDataStatus(body) {
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,
);
return data;
}
async getDataDescription(body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
@@ -226,6 +244,24 @@ class CatalogService {
return data;
}
async createDataDescription(body) {
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,
);
return data;
}
async getDataDocs(body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
@@ -241,6 +277,24 @@ class CatalogService {
return data;
}
async createDataDocs(body) {
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,
);
return data;
}
async getDataRating(body) {
const customer =
body.info.customer.toLowerCase() === 'dadosfera'
@@ -267,7 +321,7 @@ class CatalogService {
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
const { data } = await axios.post(
`${nimbusUrl}/api/catalog/data-rating/`,
body,
);
@@ -317,7 +371,7 @@ class CatalogService {
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
const { data } = await axios.post(
`${nimbusUrl}/api/catalog/data-comment/`,
body,
);
@@ -352,7 +406,7 @@ class CatalogService {
? `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);
const { data } = await axios.post(`${nimbusUrl}/api/catalog/tags/`, body);
return data;
}
@@ -400,7 +454,7 @@ class CatalogService {
? `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/${id}`);
const { data } = await axios.delete(`${nimbusUrl}/api/catalog/tags/${id}`);
return data;
}
@@ -415,7 +469,7 @@ class CatalogService {
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
const { data } = await axios.post(
`${nimbusUrl}/api/catalog/table-tags/`,
body,
);
@@ -433,7 +487,7 @@ class CatalogService {
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
const { data } = await axios.delete(
`${nimbusUrl}/api/catalog/table-tags/${id}`,
);
return data;
@@ -468,7 +522,7 @@ class CatalogService {
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
const { data } = await axios.get(
const { data } = await axios.delete(
`${nimbusUrl}/api/catalog/table-rules/${id}`,
);
return data;
+2
View File
@@ -1,4 +1,5 @@
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';
@@ -60,6 +61,7 @@ export class InputsService {
}
}
@Timeout(60000 * 10) // Timeout set for 10 minutes
async testConnection(data) {
try {
const testConnectionInputResponse = await this.inputClient.testConnection(
+1 -1
View File
File diff suppressed because one or more lines are too long