Compare commits

...
26 Commits
Author SHA1 Message Date
Gabriel Rosa f4a5f91cbb FIX: remove backmerge 2022-05-16 17:03:12 -03:00
Arthur Simas 65f6f03e55 CHORE: pinning protospack version to 1.7.4 2022-05-13 11:15:05 -03:00
Arthur Simas a54300f600 CHORE: pinning protospack version to 1.7.2 2022-05-13 11:00:25 -03:00
Arthur Simas 5ef85f79d3 Merge branch 'alpha' into beta 2022-05-13 10:49:27 -03:00
rodrigo.zamboni a8a429977f UPDATE: Implementing MFA routes on maestro 2022-05-11 18:02:01 -03:00
Gabriel Amorim 692a9de0af FEAT: add refresh token - Merge pull request #90 from dadosfera/feat/refreshToken
FEATURE: add refresh token
2022-05-11 10:37:36 -03:00
rodrigo.zamboni 7dc669ca44 FIX: fix auth trim 2022-05-10 15:53:47 -03:00
rodrigo.zamboni e897da1ef0 FIX: Fix login middleware 2022-05-10 15:32:34 -03:00
Arthur Simas b366e786ba STYLE: styling conforming to ESLint 2022-05-10 10:23:55 -03:00
Arthur Simas 24d56c7a58 FEAT: add refresh token 2022-05-09 11:47:25 -03:00
rodrigo.zamboni d7f205901b UPDATE: Changing transformation factory microservice client url to inputs factory 2022-05-05 16:27:20 -03:00
rodrigo.zamboni 7212c5249c FIX: testing timeout on testconnection input client 2022-05-04 16:44:00 -03:00
rodrigo.zamboni 827c7b1bf1 FIX: Summary-rating returning default 0 values 2022-05-04 12:00:01 -03:00
rodrigo.zamboni 8d89b747b4 FIX: Fix delete routes method 2022-05-04 00:24:44 -03:00
rodrigo.zamboni 4f18328603 FIX: update protospack lib version 2022-05-03 17:59:51 -03:00
rodrigo.zamboni a68d312447 FIX: updated protospack lib 2022-05-03 17:07:57 -03:00
rodrigo.zamboni 7f677f0376 FIX: Fix mistaken routes method 2022-05-03 16:54:03 -03:00
rodrigo.zamboni bb2c0ab23e Merge branch 'main' of https://github.com/dadosfera/maestro into main 2022-05-03 15:13:10 -03:00
rodrigo.zamboni feec48114c FIX: fixed missing nimbus catalog routes 2022-05-03 15:12:18 -03:00
Rodrigo Zamboni 7bee8d83a9 Merge pull request #89 from dadosfera/beta
Beta
2022-05-03 09:14:43 -03:00
Rodrigo Zamboni 84b2dbd178 Merge pull request #88 from dadosfera/alpha
CI: Deploy on dev env
2022-05-02 17:53:46 -03:00
rodrigo.zamboni 36706ff3dd CI: Deploy on dev env 2022-05-02 17:33:03 -03:00
Victor Radael 0164e6978a FIX: Metabase URL 2022-04-29 20:53:17 -03:00
rodrigo.zamboni 7d371926f5 FIX: fix nimbus prd url 2022-04-29 17:20:23 -03:00
rodrigo.zamboni 75e9e97f04 FIX: fix nimbus prd url 2022-04-29 17:18:21 -03:00
rodrigo.zamboni b5f58b99fd FIX: Changing nimbus prd url 2022-04-29 16:33:42 -03:00
14 changed files with 590 additions and 9314 deletions
-1
View File
@@ -38,7 +38,6 @@ jobs:
with:
semantic_version: 16
extra_plugins: |
@saithodev/semantic-release-backmerge
conventional-changelog-eslint
branches: |
[
-12
View File
@@ -26,18 +26,6 @@
"preset": "eslint"
}
],
[
"@saithodev/semantic-release-backmerge",
{
"branches": [
{ "from": "main", "to": "alpha" },
{ "from": "main", "to": "beta" }
],
"backmergeStrategy": "merge",
"clearWorkspace": true,
"restoreWorkspace": true
}
],
"@semantic-release/npm",
"@semantic-release/github"
]
+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>
+46 -9220
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.7.4",
"axios": "^0.25.0",
"dotenv": "^14.2.0",
"helmet": "^5.0.2",
+175 -3
View File
@@ -2,11 +2,16 @@ import { OnModuleInit, Inject } from '@nestjs/common';
import { ClientGrpc } from '@nestjs/microservices';
import {
AuthConfirmationRequest,
AuthDisableTotpMfaRequest,
AuthEnableTotpMfaRequest,
AuthResendConfirmationCodeRequest,
AuthServiceInterface,
AuthVerifyTotpMfaRequest,
DucServicesNames,
} from '@victorradael/protospack';
import { ILogin } from './interfaces';
import { ISignIn, IRefreshAccessToken } from './interfaces';
export class AuthClientService implements OnModuleInit {
private authService: AuthServiceInterface;
@@ -20,11 +25,11 @@ export class AuthClientService implements OnModuleInit {
);
}
async signIn({ username, password }: ILogin): Promise<any> {
async signIn({ username, password, totp }: ISignIn): 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);
},
@@ -43,4 +48,171 @@ export class AuthClientService implements OnModuleInit {
});
return tokens;
}
async enableTotpMFA({
username,
password,
}: AuthEnableTotpMfaRequest): Promise<any> {
console.log('AuthClientService', 'enableTotpMFA');
const tokens = await new Promise((resolve, reject) => {
this.authService.enableTotpMfa({ username, password }).subscribe({
next(x) {
resolve(x);
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
});
})
.then((res) => res)
.catch((err) => {
throw new Error(err);
});
return tokens;
}
async disableTotpMFA({
username,
password,
totp,
}: AuthDisableTotpMfaRequest): Promise<any> {
console.log('AuthClientService', 'disableTotpMFA');
const tokens = await new Promise((resolve, reject) => {
this.authService.disableTotpMfa({ username, password, totp }).subscribe({
next(x) {
resolve(x);
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
});
})
.then((res) => res)
.catch((err) => {
throw new Error(err);
});
return tokens;
}
async verifyTotp({
username,
accessToken,
totp,
}: AuthVerifyTotpMfaRequest): Promise<any> {
console.log('AuthClientService', 'disableTotpMFA');
const tokens = await new Promise((resolve, reject) => {
this.authService.verifyTotp({ username, accessToken, totp }).subscribe({
next(x) {
resolve(x);
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
});
})
.then((res) => res)
.catch((err) => {
throw new Error(err);
});
return tokens;
}
async confirmRegister({
username,
code,
}: AuthConfirmationRequest): Promise<any> {
console.log('AuthClientService', 'confirmRegister');
const tokens = await new Promise((resolve, reject) => {
this.authService.confirmRegister({ username, code }).subscribe({
next(x) {
resolve(x);
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
});
})
.then((res) => res)
.catch((err) => {
throw new Error(err);
});
return tokens;
}
async resendeConfirmationCode({
username,
}: AuthResendConfirmationCodeRequest): Promise<any> {
console.log('AuthClientService', 'resendeConfirmationCode');
const authResendConfirmationCodeRequestReturn = await new Promise(
(resolve, reject) => {
this.authService.resendeConfirmationCode({ username }).subscribe({
next(x) {
resolve(x);
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
});
},
)
.then((res) => res)
.catch((err) => {
throw new Error(err);
});
return authResendConfirmationCodeRequestReturn;
}
async refreshAccessToken({
username,
refreshToken,
}: IRefreshAccessToken): Promise<any> {
console.log('AuthClientService', 'RefreshAccessToken');
const tokens = await new Promise((resolve, reject) => {
this.authService
.refreshAccessToken({ username, refreshToken })
.subscribe({
next(x) {
resolve(x);
},
error(err) {
console.log('Observable Error');
reject(err);
},
complete() {
console.log('done');
},
});
})
.then((res) => res)
.catch((err) => {
throw new Error(err);
});
return tokens;
}
}
+7 -1
View File
@@ -1,4 +1,10 @@
export interface ILogin {
export interface ISignIn {
username: string;
password: string;
totp: string;
}
export interface IRefreshAccessToken {
username: string;
refreshToken: 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) {
+81 -8
View File
@@ -1,22 +1,43 @@
import { Body, Controller, Post, UnauthorizedException } from '@nestjs/common';
import {
Body,
Controller,
Headers,
Post,
UnauthorizedException,
} from '@nestjs/common';
import {
AuthEnableTotpMfaRequest,
AuthVerifyTotpMfaRequest,
} from '@victorradael/protospack';
import { AuthClientService } from 'src/clients/auth/client.service';
interface ISignIn {
username: string;
password: string;
}
import { ISignIn, IRefreshAccessToken } from 'src/clients/auth/interfaces';
@Controller('auth')
export class AuthController {
constructor(private authClient: AuthClientService) {}
// DEPRECADO!
@Post()
async signIn(@Body() { username, password }: ISignIn) {
async signIn_old(@Body() body: ISignIn) {
console.log(`/auth`, 'SignIn_old');
return this.signIn(body);
}
@Post('login')
async signIn_login(@Body() body: ISignIn) {
console.log(`/auth`, 'SignIn_login');
return this.signIn(body);
}
@Post('sign-in')
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);
@@ -24,4 +45,56 @@ export class AuthController {
return tokens;
}
@Post('refresh-access-token')
async refreshAccessToken(
@Body() { username, refreshToken }: IRefreshAccessToken,
) {
console.log(`/auth`, 'RefreshAccessToken');
const accessToken = await this.authClient
.refreshAccessToken({ username, refreshToken })
.then((result) => result)
.catch((err) => {
throw new UnauthorizedException(err.message);
});
return accessToken;
}
@Post('enable-totp')
async enableTotpMFA(
@Body() { username, password }: AuthEnableTotpMfaRequest,
) {
console.log(`/auth`, 'enable-totp');
const enableTotpResponse = await this.authClient
.enableTotpMFA({ username, password })
.then((result) => result)
.catch((err) => {
throw new UnauthorizedException(err.message);
});
return enableTotpResponse;
}
@Post('verify-totp')
async verifyTotp(
@Body() body: AuthVerifyTotpMfaRequest,
@Headers() headers,
): Promise<any> {
console.log(`/auth`, 'enable-totp');
const { username, totp } = body;
const { Authorization } = headers;
const enableTotpResponse = await this.authClient
.verifyTotp({ username, totp, accessToken: Authorization })
.then((result) => result)
.catch((err) => {
throw new UnauthorizedException(err.message);
});
return enableTotpResponse;
}
}
+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')
+229 -58
View File
@@ -9,10 +9,9 @@ class CatalogService {
const nimbusUrl =
process.env.ENV === 'prd'
? `https://nimbus${customer}.dadosfera.ai`
? `https://nimbus-${body.info.customer.toLowerCase()}.dadosfera.ai`
: `${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera`;
console.log(`${nimbusUrl}/api/catalog/all/`);
return 0;
const { data } = await axios.get(`${nimbusUrl}/api/catalog/all/`);
return data;
@@ -24,9 +23,12 @@ class CatalogService {
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.get(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data_apps/`,
);
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;
}
@@ -36,9 +38,15 @@ class CatalogService {
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.delete(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data_apps/${id}/`,
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}/`,
);
return data;
}
@@ -48,8 +56,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/dashboard-metabase/`,
`${nimbusUrl}/api/catalog/dashboard-metabase/`,
);
return data;
}
@@ -60,13 +73,19 @@ class CatalogService {
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.get(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/dashboard-metabase/${id}`,
);
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 [, path] = data.iframe_url.split('.dadosfera');
const host = `https://metabase-${body.info.customer.toLowerCase()}.dadosfera.ai`;
data.iframe_url = host + path;
const { data } = await axios.get(
`${nimbusUrl}/api/catalog/dashboard-metabase/${id}`,
);
console.log(data);
// const [, path] = data.iframe_url.split('.dadosfera');
// const host = `httpss://metabase-${body.info.customer.toLowerCase()}.dadosfera.ai`;
// data.iframe_url = host + path;
return data;
}
@@ -77,8 +96,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-metadata/`,
`${nimbusUrl}/api/catalog/table-metadata/`,
);
return data;
}
@@ -89,8 +113,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-metadata/`,
`${nimbusUrl}/api/catalog/table-metadata/`,
{ params: params },
);
return data;
@@ -102,8 +131,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-metadata/${id}`,
`${nimbusUrl}/api/catalog/table-metadata/${id}`,
);
return data;
}
@@ -114,8 +148,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/column-metadata/`,
`${nimbusUrl}/api/catalog/column-metadata/`,
{ params: params },
);
return data;
@@ -127,8 +166,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/column-metadata/${id}/`,
`${nimbusUrl}/api/catalog/column-metadata/${id}/`,
);
return data;
}
@@ -139,10 +183,14 @@ class CatalogService {
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.get(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-preview/`,
{ params: params },
);
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,
});
return data;
}
@@ -152,8 +200,29 @@ class CatalogService {
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.get(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-status/`,
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) {
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;
}
@@ -164,8 +233,31 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-description/`,
`${nimbusUrl}/api/catalog/data-description/`,
);
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;
}
@@ -176,8 +268,29 @@ class CatalogService {
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.get(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-docs/`,
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) {
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;
}
@@ -188,9 +301,12 @@ class CatalogService {
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.get(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-rating/`,
);
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;
}
@@ -200,8 +316,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-rating/`,
`${nimbusUrl}/api/catalog/data-rating/`,
body,
);
return data;
@@ -212,8 +333,14 @@ class CatalogService {
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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/summary-rating/${id}`,
`${nimbusUrl}/api/catalog/summary-rating/${id}`,
);
return data;
}
@@ -224,9 +351,12 @@ class CatalogService {
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.get(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-comment/`,
);
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;
}
@@ -236,8 +366,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-comment/`,
`${nimbusUrl}/api/catalog/data-comment/`,
body,
);
return data;
@@ -249,10 +384,14 @@ class CatalogService {
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.get(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data-review/`,
{ params: params },
);
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,
});
return data;
}
@@ -262,10 +401,12 @@ class CatalogService {
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.post(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/tags/`,
body,
);
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;
}
@@ -275,10 +416,12 @@ class CatalogService {
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.get(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/tags/`,
body,
);
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;
}
@@ -288,8 +431,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-tags/`,
`${nimbusUrl}/api/catalog/table-tags/`,
body,
);
return data;
@@ -301,9 +449,12 @@ class CatalogService {
? ``
: `-${body.info.customer.toLowerCase()}`;
const { data } = await axios.delete(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/tags/${id}`,
);
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;
}
@@ -313,8 +464,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-tags/`,
`${nimbusUrl}/api/catalog/table-tags/`,
body,
);
return data;
@@ -326,8 +482,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-tags/${id}`,
`${nimbusUrl}/api/catalog/table-tags/${id}`,
);
return data;
}
@@ -338,8 +499,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-rules/`,
`${nimbusUrl}/api/catalog/table-rules/`,
body,
);
return data;
@@ -351,8 +517,13 @@ class CatalogService {
? ``
: `-${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(
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-rules/${id}`,
`${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