mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-19 07:19:09 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b162bd0a7 | ||
|
|
829f7611e2 | ||
|
|
b986cf3281 | ||
|
|
75c7602e13 | ||
|
|
710105a4a8 | ||
|
|
30b048f776 | ||
|
|
845b95b112 | ||
|
|
6d6b024884 | ||
|
|
a4282a0dc5 | ||
|
|
4672ecb6b3 | ||
|
|
6160107d75 | ||
|
|
589a1f9d51 | ||
|
|
cb929d9b60 | ||
|
|
678bebef7e | ||
|
|
b6d7d54f9c | ||
|
|
5df8b2834c | ||
|
|
76d9571f02 | ||
|
|
0c51014ec9 | ||
|
|
7f1d8e4b2a | ||
|
|
92b78ff19d | ||
|
|
1b328b9915 | ||
|
|
e653aeea3c | ||
|
|
b49633cbc2 | ||
|
|
4d956e55c6 | ||
|
|
735703bf3b | ||
|
|
93cdc3f030 | ||
|
|
12b8b5926c | ||
|
|
1643096d47 | ||
|
|
8a519ac217 | ||
|
|
ffa69a0cf5 | ||
|
|
7722e380e3 | ||
|
|
ecdc7b4eb6 | ||
|
|
7d14080ac1 | ||
|
|
7e7deba2ab |
@@ -24,7 +24,9 @@ jobs:
|
|||||||
id: extract_environment
|
id: extract_environment
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: self-hosted
|
needs: extract_environment
|
||||||
|
runs-on:
|
||||||
|
[self-hosted, '${{ needs.extract_environment.outputs.environment }}']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|||||||
Generated
+9754
-168
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -30,10 +30,11 @@
|
|||||||
"@nestjs/microservices": "^8.4.3",
|
"@nestjs/microservices": "^8.4.3",
|
||||||
"@nestjs/platform-express": "^8.4.3",
|
"@nestjs/platform-express": "^8.4.3",
|
||||||
"@nestjs/swagger": "^5.2.1",
|
"@nestjs/swagger": "^5.2.1",
|
||||||
"@victorradael/protospack": "^1.3.9",
|
"@victorradael/protospack": "^1.5.5",
|
||||||
"axios": "^0.25.0",
|
"axios": "^0.25.0",
|
||||||
"dotenv": "^14.2.0",
|
"dotenv": "^14.2.0",
|
||||||
"grpc": "^1.24.11",
|
"grpc": "^1.24.11",
|
||||||
|
"helmet": "^5.0.2",
|
||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^8.5.1",
|
||||||
"jwk-to-pem": "^2.0.5",
|
"jwk-to-pem": "^2.0.5",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import { TransformationsClientConfiguration } from './clients/transformations/cl
|
|||||||
import { AuthClient } from './clients/auth/client.config';
|
import { AuthClient } from './clients/auth/client.config';
|
||||||
import { InputsClientConfiguration } from './clients/inputs/client.config';
|
import { InputsClientConfiguration } from './clients/inputs/client.config';
|
||||||
import { PipelinesClientConfiguration } from './clients/pipelines/client.config';
|
import { PipelinesClientConfiguration } from './clients/pipelines/client.config';
|
||||||
|
import { CatalogController } from './modules/catalog/catalog.controller';
|
||||||
|
import { CatalogService } from './modules/catalog/catalog.service';
|
||||||
|
|
||||||
const authClient = new AuthClient();
|
const authClient = new AuthClient();
|
||||||
const inputClient = new InputsClientConfiguration();
|
const inputClient = new InputsClientConfiguration();
|
||||||
@@ -44,6 +46,7 @@ const transformationClient = new TransformationsClientConfiguration();
|
|||||||
PipelinesController,
|
PipelinesController,
|
||||||
AuthController,
|
AuthController,
|
||||||
HealthController,
|
HealthController,
|
||||||
|
CatalogController,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
InputsService,
|
InputsService,
|
||||||
@@ -57,6 +60,7 @@ const transformationClient = new TransformationsClientConfiguration();
|
|||||||
OutputsClientService,
|
OutputsClientService,
|
||||||
PipelinesClientService,
|
PipelinesClientService,
|
||||||
AuthClientService,
|
AuthClientService,
|
||||||
|
CatalogService,
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
@@ -97,6 +101,7 @@ export class AppModule implements NestModule {
|
|||||||
TransformationsController,
|
TransformationsController,
|
||||||
OutputsController,
|
OutputsController,
|
||||||
PipelinesController,
|
PipelinesController,
|
||||||
|
CatalogController,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { credentials } from '@grpc/grpc-js';
|
import { credentials } from '@grpc/grpc-js';
|
||||||
import { ClientOptions, Transport } from '@nestjs/microservices';
|
import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||||
|
|
||||||
import { DucProtofile } from '@victorradael/protospack';
|
import { DucProtoFilePath, DucPackages } from '@victorradael/protospack';
|
||||||
|
|
||||||
export class AuthClient {
|
export class AuthClient {
|
||||||
config(): ClientOptions {
|
config(): ClientOptions {
|
||||||
@@ -9,9 +9,9 @@ export class AuthClient {
|
|||||||
transport: Transport.GRPC,
|
transport: Transport.GRPC,
|
||||||
options: {
|
options: {
|
||||||
url: process.env.DUC_URL,
|
url: process.env.DUC_URL,
|
||||||
package: 'duc',
|
package: DucPackages,
|
||||||
credentials: credentials.createSsl(),
|
credentials: credentials.createSsl(),
|
||||||
protoPath: DucProtofile,
|
protoPath: DucProtoFilePath,
|
||||||
loader: {
|
loader: {
|
||||||
enums: String,
|
enums: String,
|
||||||
objects: true,
|
objects: true,
|
||||||
|
|||||||
@@ -1,27 +1,30 @@
|
|||||||
import { OnModuleInit, Inject } from '@nestjs/common';
|
import { OnModuleInit, Inject } from '@nestjs/common';
|
||||||
import { ClientGrpc } from '@nestjs/microservices';
|
import { ClientGrpc } from '@nestjs/microservices';
|
||||||
|
|
||||||
import { CognitoServiceInterface } from '@victorradael/protospack';
|
import {
|
||||||
|
AuthServiceInterface,
|
||||||
|
DucServicesNames,
|
||||||
|
} from '@victorradael/protospack';
|
||||||
|
|
||||||
import { ILogin } from './interfaces';
|
import { ILogin } from './interfaces';
|
||||||
|
|
||||||
export class AuthClientService implements OnModuleInit {
|
export class AuthClientService implements OnModuleInit {
|
||||||
private cognitoService: CognitoServiceInterface;
|
private authService: AuthServiceInterface;
|
||||||
constructor(
|
constructor(
|
||||||
@Inject('AUTH_PACKAGE') private readonly grpcClient: ClientGrpc,
|
@Inject('AUTH_PACKAGE') private readonly grpcClient: ClientGrpc,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
onModuleInit() {
|
onModuleInit() {
|
||||||
this.cognitoService = this.grpcClient.getService<CognitoServiceInterface>(
|
this.authService = this.grpcClient.getService<AuthServiceInterface>(
|
||||||
'CognitoProtoService',
|
DucServicesNames.AuthProtoService,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async signIn({ username, password }: ILogin): Promise<any> {
|
async signIn({ username, password }: ILogin): Promise<any> {
|
||||||
console.log('CognitoClientService', 'SignIn');
|
console.log('AuthClientService', 'SignIn');
|
||||||
|
|
||||||
const tokens = await new Promise((resolve, reject) => {
|
const tokens = await new Promise((resolve, reject) => {
|
||||||
this.cognitoService.signIn({ username, password }).subscribe({
|
this.authService.signIn({ username, password }).subscribe({
|
||||||
next(x) {
|
next(x) {
|
||||||
resolve(x);
|
resolve(x);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { credentials } from '@grpc/grpc-js';
|
import { credentials } from '@grpc/grpc-js';
|
||||||
import { ClientOptions, Transport } from '@nestjs/microservices';
|
import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||||
|
|
||||||
import { InputProtofile } from '@victorradael/protospack';
|
import { InputPackages, InputProtoFilePath } from '@victorradael/protospack';
|
||||||
|
|
||||||
export class InputsClientConfiguration {
|
export class InputsClientConfiguration {
|
||||||
config(): ClientOptions {
|
config(): ClientOptions {
|
||||||
@@ -9,9 +9,9 @@ export class InputsClientConfiguration {
|
|||||||
transport: Transport.GRPC,
|
transport: Transport.GRPC,
|
||||||
options: {
|
options: {
|
||||||
url: process.env.INFACTORY_URL,
|
url: process.env.INFACTORY_URL,
|
||||||
package: 'input',
|
package: InputPackages,
|
||||||
credentials: credentials.createSsl(),
|
credentials: credentials.createSsl(),
|
||||||
protoPath: InputProtofile,
|
protoPath: InputProtoFilePath,
|
||||||
loader: {
|
loader: {
|
||||||
enums: String,
|
enums: String,
|
||||||
objects: true,
|
objects: true,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { OutputProtofile } from '@victorradael/protospack';
|
import { OutputPackages, OutputProtoFilePath } from '@victorradael/protospack';
|
||||||
import { ClientOptions, Transport } from '@nestjs/microservices';
|
import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||||
import { credentials } from '@grpc/grpc-js';
|
import { credentials } from '@grpc/grpc-js';
|
||||||
|
|
||||||
@@ -8,9 +8,9 @@ export class OutputsClientConfiguration {
|
|||||||
transport: Transport.GRPC,
|
transport: Transport.GRPC,
|
||||||
options: {
|
options: {
|
||||||
url: process.env.OTFACTORY_URL,
|
url: process.env.OTFACTORY_URL,
|
||||||
package: 'output',
|
package: OutputPackages,
|
||||||
credentials: credentials.createSsl(),
|
credentials: credentials.createSsl(),
|
||||||
protoPath: OutputProtofile,
|
protoPath: OutputProtoFilePath,
|
||||||
loader: {
|
loader: {
|
||||||
enums: String,
|
enums: String,
|
||||||
objects: true,
|
objects: true,
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import { Controller, Inject, OnModuleInit } from '@nestjs/common';
|
import { Controller, Inject, OnModuleInit } from '@nestjs/common';
|
||||||
import { ClientGrpc, Payload } from '@nestjs/microservices';
|
import { ClientGrpc, Payload } from '@nestjs/microservices';
|
||||||
import { OutputsServiceInterface } from '@victorradael/protospack';
|
import {
|
||||||
|
OutputServicesNames,
|
||||||
|
OutputsServiceInterface,
|
||||||
|
} from '@victorradael/protospack';
|
||||||
import {
|
import {
|
||||||
objectCamelToSnake,
|
objectCamelToSnake,
|
||||||
objectSnakeToCamel,
|
objectSnakeToCamel,
|
||||||
@@ -19,8 +22,9 @@ export class OutputsClientService implements OnModuleInit {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
onModuleInit() {
|
onModuleInit() {
|
||||||
this.outputService =
|
this.outputService = this.grpcClient.getService<OutputsServiceInterface>(
|
||||||
this.grpcClient.getService<OutputsServiceInterface>('OutputService');
|
OutputServicesNames.OutputService,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(@Payload() createOutputDto: ICreateOutputRequest) {
|
async create(@Payload() createOutputDto: ICreateOutputRequest) {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import { ClientOptions, Transport } from '@nestjs/microservices';
|
import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||||
import { PipelineProtofile } from '@victorradael/protospack';
|
import {
|
||||||
|
PipelinePackages,
|
||||||
|
PipelineProtoFilePath,
|
||||||
|
} from '@victorradael/protospack';
|
||||||
import { credentials } from '@grpc/grpc-js';
|
import { credentials } from '@grpc/grpc-js';
|
||||||
|
|
||||||
export class PipelinesClientConfiguration {
|
export class PipelinesClientConfiguration {
|
||||||
@@ -8,9 +11,9 @@ export class PipelinesClientConfiguration {
|
|||||||
transport: Transport.GRPC,
|
transport: Transport.GRPC,
|
||||||
options: {
|
options: {
|
||||||
url: process.env.PIFACTORY_URL,
|
url: process.env.PIFACTORY_URL,
|
||||||
package: 'pipeline',
|
package: PipelinePackages,
|
||||||
credentials: credentials.createSsl(),
|
credentials: credentials.createSsl(),
|
||||||
protoPath: PipelineProtofile,
|
protoPath: PipelineProtoFilePath,
|
||||||
loader: {
|
loader: {
|
||||||
enums: String,
|
enums: String,
|
||||||
objects: true,
|
objects: true,
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
import { Inject, OnModuleInit } from '@nestjs/common';
|
import { Inject, OnModuleInit } from '@nestjs/common';
|
||||||
import { ClientGrpc, Payload } from '@nestjs/microservices';
|
import { ClientGrpc, Payload } from '@nestjs/microservices';
|
||||||
import { PipelinesServiceInterface } from '@victorradael/protospack';
|
import {
|
||||||
|
PipelineServicesNames,
|
||||||
|
PipelinesServiceInterface,
|
||||||
|
} from '@victorradael/protospack';
|
||||||
import {
|
import {
|
||||||
objectCamelToSnake,
|
objectCamelToSnake,
|
||||||
objectSnakeToCamel,
|
objectSnakeToCamel,
|
||||||
} from 'src/utils/CaseConverter';
|
} from 'src/utils/CaseConverter';
|
||||||
import {
|
import {
|
||||||
ICreatePipelineDto,
|
ICreatePipelineDto,
|
||||||
IdRequest,
|
|
||||||
IGetPipelineLogsRequest,
|
IGetPipelineLogsRequest,
|
||||||
IIdRequest,
|
IIdRequest,
|
||||||
IUpdatePipelineRequest,
|
IUpdatePipelineRequest,
|
||||||
@@ -21,7 +23,9 @@ export class PipelinesClientService implements OnModuleInit {
|
|||||||
|
|
||||||
onModuleInit() {
|
onModuleInit() {
|
||||||
this.pipelineService =
|
this.pipelineService =
|
||||||
this.grpcClient.getService<PipelinesServiceInterface>('PipelineService');
|
this.grpcClient.getService<PipelinesServiceInterface>(
|
||||||
|
PipelineServicesNames.PipelineService,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async create(@Payload() createPipelineDto: ICreatePipelineDto) {
|
async create(@Payload() createPipelineDto: ICreatePipelineDto) {
|
||||||
@@ -29,7 +33,7 @@ export class PipelinesClientService implements OnModuleInit {
|
|||||||
|
|
||||||
const createPipelineResponse = await new Promise((resolve, reject) => {
|
const createPipelineResponse = await new Promise((resolve, reject) => {
|
||||||
this.pipelineService
|
this.pipelineService
|
||||||
.create(objectSnakeToCamel(createPipelineDto))
|
.Create(objectSnakeToCamel(createPipelineDto))
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next(x) {
|
next(x) {
|
||||||
resolve(x);
|
resolve(x);
|
||||||
@@ -55,7 +59,7 @@ export class PipelinesClientService implements OnModuleInit {
|
|||||||
console.log('PipelinesClientService', 'FindAll');
|
console.log('PipelinesClientService', 'FindAll');
|
||||||
|
|
||||||
const findAllPipelineResponse = await new Promise((resolve, reject) => {
|
const findAllPipelineResponse = await new Promise((resolve, reject) => {
|
||||||
this.pipelineService.findAll(objectSnakeToCamel(data)).subscribe({
|
this.pipelineService.FindAll(objectSnakeToCamel(data)).subscribe({
|
||||||
next(x) {
|
next(x) {
|
||||||
resolve(x);
|
resolve(x);
|
||||||
},
|
},
|
||||||
@@ -80,7 +84,7 @@ export class PipelinesClientService implements OnModuleInit {
|
|||||||
console.log('PipelinesClientService', 'FindOne');
|
console.log('PipelinesClientService', 'FindOne');
|
||||||
|
|
||||||
const findOnePipelineResponse = await new Promise((resolve, reject) => {
|
const findOnePipelineResponse = await new Promise((resolve, reject) => {
|
||||||
this.pipelineService.findOne(objectSnakeToCamel(data)).subscribe({
|
this.pipelineService.FindOne(objectSnakeToCamel(data)).subscribe({
|
||||||
next(x) {
|
next(x) {
|
||||||
resolve(x);
|
resolve(x);
|
||||||
},
|
},
|
||||||
@@ -106,7 +110,7 @@ export class PipelinesClientService implements OnModuleInit {
|
|||||||
|
|
||||||
const updatePipelineResponse = await new Promise((resolve, reject) => {
|
const updatePipelineResponse = await new Promise((resolve, reject) => {
|
||||||
this.pipelineService
|
this.pipelineService
|
||||||
.update(objectSnakeToCamel(UpdatePipelineRequest))
|
.Update(objectSnakeToCamel(UpdatePipelineRequest))
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next(x) {
|
next(x) {
|
||||||
resolve(x);
|
resolve(x);
|
||||||
@@ -178,11 +182,11 @@ export class PipelinesClientService implements OnModuleInit {
|
|||||||
return logsPipelineResponse;
|
return logsPipelineResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPipelineStatus({ id }: IdRequest) {
|
async getPipelineStatus(data: IIdRequest) {
|
||||||
console.log('PipelinesClientService', 'GetPipelineStatus');
|
console.log('PipelinesClientService', 'GetPipelineStatus');
|
||||||
|
|
||||||
const statusPipelineResponse = await new Promise((resolve, reject) => {
|
const statusPipelineResponse = await new Promise((resolve, reject) => {
|
||||||
this.pipelineService.getPipelineStatus({ id }).subscribe({
|
this.pipelineService.getPipelineStatus(data).subscribe({
|
||||||
next(x) {
|
next(x) {
|
||||||
resolve(x);
|
resolve(x);
|
||||||
},
|
},
|
||||||
@@ -202,4 +206,30 @@ export class PipelinesClientService implements OnModuleInit {
|
|||||||
|
|
||||||
return statusPipelineResponse;
|
return statusPipelineResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async runPipeline({ id, info }: IIdRequest) {
|
||||||
|
console.log('PipelinesClientService', 'RunPipeline');
|
||||||
|
const statusPipelineResponse = await new Promise((resolve, reject) => {
|
||||||
|
this.pipelineService
|
||||||
|
.triggerPipeline(objectSnakeToCamel({ id, info }))
|
||||||
|
.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 statusPipelineResponse;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import { ClientOptions, Transport } from '@nestjs/microservices';
|
import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||||
import { TransformationProtofile } from '@victorradael/protospack';
|
import {
|
||||||
|
TransformationPackages,
|
||||||
|
TransformationProtoFilePath,
|
||||||
|
} from '@victorradael/protospack';
|
||||||
import { credentials } from '@grpc/grpc-js';
|
import { credentials } from '@grpc/grpc-js';
|
||||||
|
|
||||||
export class TransformationsClientConfiguration {
|
export class TransformationsClientConfiguration {
|
||||||
@@ -8,9 +11,9 @@ export class TransformationsClientConfiguration {
|
|||||||
transport: Transport.GRPC,
|
transport: Transport.GRPC,
|
||||||
options: {
|
options: {
|
||||||
url: process.env.TRFACTORY_URL,
|
url: process.env.TRFACTORY_URL,
|
||||||
package: 'transformation',
|
package: TransformationPackages,
|
||||||
credentials: credentials.createSsl(),
|
credentials: credentials.createSsl(),
|
||||||
protoPath: TransformationProtofile,
|
protoPath: TransformationProtoFilePath,
|
||||||
loader: {
|
loader: {
|
||||||
enums: String,
|
enums: String,
|
||||||
objects: true,
|
objects: true,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export class TransformationsClientService implements OnModuleInit {
|
|||||||
const createTransformationResponse = await new Promise(
|
const createTransformationResponse = await new Promise(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this.transformationService
|
this.transformationService
|
||||||
.create(objectSnakeToCamel(createTransformationsDto))
|
.Create(objectSnakeToCamel(createTransformationsDto))
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next(x) {
|
next(x) {
|
||||||
resolve(x);
|
resolve(x);
|
||||||
@@ -62,7 +62,7 @@ export class TransformationsClientService implements OnModuleInit {
|
|||||||
|
|
||||||
const findAllTransformationResponse = await new Promise(
|
const findAllTransformationResponse = await new Promise(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this.transformationService.findAll(objectSnakeToCamel(data)).subscribe({
|
this.transformationService.FindAll(objectSnakeToCamel(data)).subscribe({
|
||||||
next(x) {
|
next(x) {
|
||||||
resolve(x);
|
resolve(x);
|
||||||
},
|
},
|
||||||
@@ -93,7 +93,7 @@ export class TransformationsClientService implements OnModuleInit {
|
|||||||
|
|
||||||
const findOneTransformationResponse = await new Promise(
|
const findOneTransformationResponse = await new Promise(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this.transformationService.findOne(objectSnakeToCamel(data)).subscribe({
|
this.transformationService.FindOne(objectSnakeToCamel(data)).subscribe({
|
||||||
next(x) {
|
next(x) {
|
||||||
resolve(x);
|
resolve(x);
|
||||||
},
|
},
|
||||||
@@ -121,7 +121,7 @@ export class TransformationsClientService implements OnModuleInit {
|
|||||||
const updateTransformationResponse = await new Promise(
|
const updateTransformationResponse = await new Promise(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this.transformationService
|
this.transformationService
|
||||||
.update(objectSnakeToCamel(updateTransformationDTO))
|
.Update(objectSnakeToCamel(updateTransformationDTO))
|
||||||
.subscribe({
|
.subscribe({
|
||||||
next(x) {
|
next(x) {
|
||||||
resolve(x);
|
resolve(x);
|
||||||
@@ -149,7 +149,7 @@ export class TransformationsClientService implements OnModuleInit {
|
|||||||
|
|
||||||
const removeTransformationResponse = await new Promise(
|
const removeTransformationResponse = await new Promise(
|
||||||
(resolve, reject) => {
|
(resolve, reject) => {
|
||||||
this.transformationService.remove(objectSnakeToCamel(data)).subscribe({
|
this.transformationService.Remove(objectSnakeToCamel(data)).subscribe({
|
||||||
next(x) {
|
next(x) {
|
||||||
resolve(x);
|
resolve(x);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from '@nestjs/core';
|
||||||
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||||
import { writeFileSync } from 'fs';
|
import { writeFileSync } from 'fs';
|
||||||
|
import helmet from 'helmet';
|
||||||
|
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
@@ -14,6 +15,8 @@ async function bootstrap() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.use(helmet());
|
||||||
|
|
||||||
const config = new DocumentBuilder()
|
const config = new DocumentBuilder()
|
||||||
.setTitle('Maestro Grpc Documentation')
|
.setTitle('Maestro Grpc Documentation')
|
||||||
.setDescription('Documentation for Maestro gateway')
|
.setDescription('Documentation for Maestro gateway')
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import { HttpExceptionFilter } from 'src/error/http-exception.filter';
|
|||||||
@UseFilters(new HttpExceptionFilter())
|
@UseFilters(new HttpExceptionFilter())
|
||||||
export class LoggerMiddleware implements NestMiddleware {
|
export class LoggerMiddleware implements NestMiddleware {
|
||||||
use = async (request: Request, response: Response, next: NextFunction) => {
|
use = async (request: Request, response: Response, next: NextFunction) => {
|
||||||
console.log('Middle', new Date());
|
|
||||||
const idToken = request.get('Dadosfera-User');
|
const idToken = request.get('Dadosfera-User');
|
||||||
const accessToken = request.get('Authorization');
|
const accessToken = request.get('Authorization');
|
||||||
const privateKey = process.env.JWT_PRIVATE_KEY;
|
const privateKey = process.env.JWT_PRIVATE_KEY;
|
||||||
@@ -31,6 +30,7 @@ export class LoggerMiddleware implements NestMiddleware {
|
|||||||
|
|
||||||
const permissions = jwtDecoded.user.permissions;
|
const permissions = jwtDecoded.user.permissions;
|
||||||
const clienId = jwtDecoded.user.customerId;
|
const clienId = jwtDecoded.user.customerId;
|
||||||
|
const customer = jwtDecoded.user.customer;
|
||||||
const userId = jwtDecoded.user.id;
|
const userId = jwtDecoded.user.id;
|
||||||
|
|
||||||
await verifyToken(accessToken);
|
await verifyToken(accessToken);
|
||||||
@@ -50,6 +50,7 @@ export class LoggerMiddleware implements NestMiddleware {
|
|||||||
request.body.info = {
|
request.body.info = {
|
||||||
customer_id: clienId,
|
customer_id: clienId,
|
||||||
user_id: userId,
|
user_id: userId,
|
||||||
|
customer,
|
||||||
};
|
};
|
||||||
|
|
||||||
next();
|
next();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Body, Controller, Post } from '@nestjs/common';
|
import { Body, Controller, Post, UnauthorizedException } from '@nestjs/common';
|
||||||
|
|
||||||
import { AuthClientService } from 'src/clients/auth/client.service';
|
import { AuthClientService } from 'src/clients/auth/client.service';
|
||||||
|
|
||||||
@@ -18,7 +18,9 @@ export class AuthController {
|
|||||||
const tokens = await this.authClient
|
const tokens = await this.authClient
|
||||||
.signIn({ username, password })
|
.signIn({ username, password })
|
||||||
.then((result) => result)
|
.then((result) => result)
|
||||||
.catch((err) => console.log(err));
|
.catch((err) => {
|
||||||
|
throw new UnauthorizedException(err.message);
|
||||||
|
});
|
||||||
|
|
||||||
return tokens;
|
return tokens;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,289 @@
|
|||||||
|
import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common';
|
||||||
|
import { CatalogService } from './catalog.service';
|
||||||
|
|
||||||
|
@Controller('catalog')
|
||||||
|
export class CatalogController {
|
||||||
|
constructor(private catalogService: CatalogService) {}
|
||||||
|
|
||||||
|
@Get('all')
|
||||||
|
async catalogAll(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON CATALOG ALL ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.catalogAll(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('data_apps')
|
||||||
|
async dataAppsAll(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON FIND ALL DATA APPS ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.dataAppsAll(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete('data_apps/:id')
|
||||||
|
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 catalogService.dataAppsOne(body, id);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('dashboard-metabase')
|
||||||
|
async getAllDashboardMetabase(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET ALL DASHBOARDS METABASE ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getAllDashboardMetabase(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('dashboard-metabase/:id')
|
||||||
|
async getOneDashboardMetabase(@Body() body, @Param() params) {
|
||||||
|
const { id } = params;
|
||||||
|
console.log(`/catalog`, 'ON GET ONE DASHBOARD METABASE ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getOneDashboardMetabase(body, id);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('table-metadata')
|
||||||
|
async getAllTableMetadata(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET ALL TABLES METADATA ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getAllTableMetadata(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete('table-metadata')
|
||||||
|
async deleteOneTableMetadata(@Param() params, @Body() body) {
|
||||||
|
const { id } = params;
|
||||||
|
console.log(`/catalog`, 'ON DELETE ONE TABLE METADATA ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.deleteOneTableMetadata(body, id);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('column-metadata')
|
||||||
|
async getOneColumnMetadata(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET ONE COLUMN METADATA ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getOneColumnMetadata(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete('column-metadata')
|
||||||
|
async deleteOneColumnMetadata(@Param() params, @Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON DELETE ONE COLUMN METADATA ROUTE');
|
||||||
|
const { id } = params;
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.deleteOneColumnMetadata(body, id);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('data-preview')
|
||||||
|
async getOneDataPreview(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET ONE DATAPREVIEW ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getOneDataPreview(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('data-status')
|
||||||
|
async getDataStatus(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET DATA STATUS ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getDataStatus(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('data-description')
|
||||||
|
async getDataDescription(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET DATA DESCRIPTION ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getDataDescription(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('data-docs')
|
||||||
|
async getDataDocs(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET DATA DOCS ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getDataDocs(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('data-rating')
|
||||||
|
async getDataRating(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET DATA RATING ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getDataRating(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('summary-rating/:id')
|
||||||
|
async getSummaryRating(@Param() params, @Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET SUMMARY RATING ROUTE');
|
||||||
|
const { id } = params;
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getSummaryRating(id, body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('data-comment')
|
||||||
|
async getDataComment(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET DATA COMMENT ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getDataComment(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('data-review')
|
||||||
|
async getDataReview(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET DATA REVIEW ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getDataReview(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post('tags')
|
||||||
|
async createTags(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON CREATE TAG ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.createTags(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('tags')
|
||||||
|
async findAllTags(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON FIND ALL TAGS ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.findAllTags(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete('tags/:id')
|
||||||
|
async deleteTags(@Param() params, @Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON DELETE TAG ROUTE');
|
||||||
|
const { id } = params;
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.deleteTags(body, id);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post('table-tags')
|
||||||
|
async createTableTags(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON CREATE TABLE TAG ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.createTableTags(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('table-tags')
|
||||||
|
async getAllTableTags(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET ALL TABLE TAGS ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.findAllTableTags(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete('table-tags')
|
||||||
|
async deleteTableTags(@Param() params, @Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON CREATE TABLE TAGS ROUTE');
|
||||||
|
const { id } = params;
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.deleteTableTags(body, id);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get('table-rules')
|
||||||
|
async getTableRules(@Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON GET TABLE RULES ROUTE');
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.getTableRules(body);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete('table-rules')
|
||||||
|
async deleteTableRules(@Param() params, @Body() body) {
|
||||||
|
console.log(`/catalog`, 'ON DELETE TABLE RULES ROUTE');
|
||||||
|
const { id } = params;
|
||||||
|
|
||||||
|
const catalogService = new CatalogService();
|
||||||
|
|
||||||
|
const res = await catalogService.deleteTableRules(body, id);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,311 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
class CatalogService {
|
||||||
|
async catalogAll(body) {
|
||||||
|
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/all/`,
|
||||||
|
);
|
||||||
|
console.log(
|
||||||
|
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/all/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async dataAppsAll(body) {
|
||||||
|
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/data_apps/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async dataAppsOne(id, body) {
|
||||||
|
const customer =
|
||||||
|
body.info.customer.toLowerCase() === 'dadosfera'
|
||||||
|
? ``
|
||||||
|
: `-${body.info.customer.toLowerCase()}`;
|
||||||
|
|
||||||
|
const { data } = await axios.delete(
|
||||||
|
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/data_apps/${id}/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getAllDashboardMetabase(body) {
|
||||||
|
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/dashboard-metabase/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getOneDashboardMetabase(body, id) {
|
||||||
|
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/dashboard-metabase/${id}`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getAllTableMetadata(body) {
|
||||||
|
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/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteOneTableMetadata(id, body) {
|
||||||
|
const customer =
|
||||||
|
body.info.customer.toLowerCase() === 'dadosfera'
|
||||||
|
? ``
|
||||||
|
: `-${body.info.customer.toLowerCase()}`;
|
||||||
|
|
||||||
|
const { data } = await axios.delete(
|
||||||
|
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-metadata/${id}`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getOneColumnMetadata(body) {
|
||||||
|
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/column-metadata/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteOneColumnMetadata(id, body) {
|
||||||
|
const customer =
|
||||||
|
body.info.customer.toLowerCase() === 'dadosfera'
|
||||||
|
? ``
|
||||||
|
: `-${body.info.customer.toLowerCase()}`;
|
||||||
|
|
||||||
|
const { data } = await axios.delete(
|
||||||
|
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/column-metadata/${id}/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getOneDataPreview(body) {
|
||||||
|
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/data-preview/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDataStatus(body) {
|
||||||
|
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/data-status/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDataDescription(body) {
|
||||||
|
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/data-description/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDataDocs(body) {
|
||||||
|
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/data-docs/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDataRating(body) {
|
||||||
|
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/data-rating/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getSummaryRating(id, body) {
|
||||||
|
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/summary-rating/${id}`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDataComment(body) {
|
||||||
|
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/data-comment/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getDataReview(body) {
|
||||||
|
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/data-review/`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async createTags(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/tags/`,
|
||||||
|
body,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async findAllTags(body) {
|
||||||
|
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/tags/`,
|
||||||
|
body,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async findAllTableTags(body) {
|
||||||
|
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-tags/`,
|
||||||
|
body,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteTags(id, body) {
|
||||||
|
const customer =
|
||||||
|
body.info.customer.toLowerCase() === 'dadosfera'
|
||||||
|
? ``
|
||||||
|
: `-${body.info.customer.toLowerCase()}`;
|
||||||
|
|
||||||
|
const { data } = await axios.delete(
|
||||||
|
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/tags/${id}`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async createTableTags(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/table-tags/`,
|
||||||
|
body,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteTableTags(id, body) {
|
||||||
|
const customer =
|
||||||
|
body.info.customer.toLowerCase() === 'dadosfera'
|
||||||
|
? ``
|
||||||
|
: `-${body.info.customer.toLowerCase()}`;
|
||||||
|
|
||||||
|
const { data } = await axios.delete(
|
||||||
|
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-tags/${id}`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async getTableRules(body) {
|
||||||
|
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-rules/`,
|
||||||
|
body,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
async deleteTableRules(id, body) {
|
||||||
|
const customer =
|
||||||
|
body.info.customer.toLowerCase() === 'dadosfera'
|
||||||
|
? ``
|
||||||
|
: `-${body.info.customer.toLowerCase()}`;
|
||||||
|
|
||||||
|
const { data } = await axios.delete(
|
||||||
|
`${process.env.NIMBUS_BASE_URL}${customer}.${process.env.ENV}.dadosfera/api/catalog/table-rules/${id}`,
|
||||||
|
);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export { CatalogService };
|
||||||
@@ -14,16 +14,34 @@ import { PipelinesService } from './pipelines.service';
|
|||||||
export class PipelinesController {
|
export class PipelinesController {
|
||||||
constructor(private pipelinesClientService: PipelinesClientService) {}
|
constructor(private pipelinesClientService: PipelinesClientService) {}
|
||||||
|
|
||||||
@Get(':id/status')
|
@Get('start/:id')
|
||||||
async getPipelineStatus(@Param() params) {
|
async activate(@Param() params, @Body() body) {
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
|
const { info } = body;
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
process.env.DEV_URL + `/transformation/start/${id}`,
|
||||||
|
'ON START PIPELINE ROUTE',
|
||||||
|
);
|
||||||
|
|
||||||
|
const pipelineService = new PipelinesService(this.pipelinesClientService);
|
||||||
|
const response = await pipelineService.runPipeline({ id, info });
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Get(':id/status')
|
||||||
|
async getPipelineStatus(@Body() body, @Param() params) {
|
||||||
|
const { id } = params;
|
||||||
|
body.id = id;
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
process.env.DEV_URL + `/pipeline/${id}`,
|
process.env.DEV_URL + `/pipeline/${id}`,
|
||||||
'ON GET PIPELINE STATUS ROUTE',
|
'ON GET PIPELINE STATUS ROUTE',
|
||||||
);
|
);
|
||||||
|
|
||||||
const pipelineService = new PipelinesService(this.pipelinesClientService);
|
const pipelineService = new PipelinesService(this.pipelinesClientService);
|
||||||
const response = await pipelineService.getPipelineStatus(id);
|
const response = await pipelineService.getPipelineStatus(body);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,14 +74,27 @@ export class PipelinesService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getPipelineStatus(id: string) {
|
async getPipelineStatus(data: IIdRequest) {
|
||||||
try {
|
try {
|
||||||
const pipelineStatusResponse =
|
const pipelineStatusResponse =
|
||||||
await this.pipelineClient.getPipelineStatus({ id });
|
await this.pipelineClient.getPipelineStatus(data);
|
||||||
|
|
||||||
return objectCamelToSnake(pipelineStatusResponse);
|
return objectCamelToSnake(pipelineStatusResponse);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
|
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async runPipeline({ id, info }: IIdRequest) {
|
||||||
|
try {
|
||||||
|
const triggerPipelineResponse = await this.pipelineClient.runPipeline({
|
||||||
|
id,
|
||||||
|
info,
|
||||||
|
});
|
||||||
|
|
||||||
|
return objectCamelToSnake(triggerPipelineResponse);
|
||||||
|
} catch (err) {
|
||||||
|
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,15 +11,20 @@ export class TransformationsService {
|
|||||||
constructor(private transformationClient: TransformationsClientService) {}
|
constructor(private transformationClient: TransformationsClientService) {}
|
||||||
|
|
||||||
async create(createTransformationDto: ICreateTransformationsRequest) {
|
async create(createTransformationDto: ICreateTransformationsRequest) {
|
||||||
|
const { transformations, info } = createTransformationDto;
|
||||||
|
|
||||||
|
if (!transformations || transformations.length == 0) {
|
||||||
|
throw new HttpException('Missing transformations field.', 400);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const convertedDTO = createTransformationDto.transformations.map((tr) => {
|
const convertedDTO = transformations.map((tr) => {
|
||||||
return trSnakeToCamel(tr);
|
return trSnakeToCamel(tr);
|
||||||
});
|
});
|
||||||
|
|
||||||
const createTransformationResponse =
|
const createTransformationResponse =
|
||||||
await this.transformationClient.create({
|
await this.transformationClient.create({
|
||||||
transformations: convertedDTO,
|
transformations: convertedDTO,
|
||||||
info: createTransformationDto.info,
|
info: info,
|
||||||
});
|
});
|
||||||
|
|
||||||
return createTransformationResponse;
|
return createTransformationResponse;
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user