mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-26 16:59:08 +00:00
REFACTOR: Project Pattern and AuthClient (DUC)
This commit is contained in:
@@ -41,3 +41,6 @@ lerna-debug.log*
|
||||
.elasticbeanstalk/*
|
||||
!.elasticbeanstalk/*.cfg.yml
|
||||
!.elasticbeanstalk/*.global.yml
|
||||
|
||||
|
||||
.env
|
||||
Generated
+1622
-752
File diff suppressed because it is too large
Load Diff
+21
-19
@@ -21,14 +21,16 @@
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.5.0",
|
||||
"@grpc/grpc-js": "^1.5.7",
|
||||
"@grpc/proto-loader": "^0.6.9",
|
||||
"@nestjs/common": "^8.0.0",
|
||||
"@nestjs/core": "^8.0.0",
|
||||
"@nestjs/common": "^8.4.0",
|
||||
"@nestjs/config": "^1.2.0",
|
||||
"@nestjs/core": "^8.4.0",
|
||||
"@nestjs/mapped-types": "*",
|
||||
"@nestjs/microservices": "^8.2.4",
|
||||
"@nestjs/platform-express": "^8.0.0",
|
||||
"@nestjs/microservices": "^8.4.0",
|
||||
"@nestjs/platform-express": "^8.4.0",
|
||||
"@nestjs/swagger": "^5.1.5",
|
||||
"@victorradael/protospack": "^1.1.3",
|
||||
"axios": "^0.25.0",
|
||||
"dotenv": "^14.2.0",
|
||||
"grpc": "^1.24.11",
|
||||
@@ -36,33 +38,33 @@
|
||||
"jwk-to-pem": "^2.0.5",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"rxjs": "^7.2.0",
|
||||
"rxjs": "^7.5.5",
|
||||
"swagger-ui-express": "^4.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "^8.0.0",
|
||||
"@nestjs/schematics": "^8.0.0",
|
||||
"@nestjs/testing": "^8.0.0",
|
||||
"@nestjs/cli": "^8.2.2",
|
||||
"@nestjs/schematics": "^8.0.8",
|
||||
"@nestjs/testing": "^8.4.0",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/jest": "27.0.2",
|
||||
"@types/jsonwebtoken": "^8.5.8",
|
||||
"@types/jwk-to-pem": "^2.0.1",
|
||||
"@types/node": "^16.0.0",
|
||||
"@types/node": "^16.11.26",
|
||||
"@types/supertest": "^2.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
||||
"@typescript-eslint/parser": "^5.0.0",
|
||||
"eslint": "^8.0.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
||||
"@typescript-eslint/parser": "^5.14.0",
|
||||
"eslint": "^8.10.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"jest": "^27.2.5",
|
||||
"jest": "^27.5.1",
|
||||
"prettier": "^2.3.2",
|
||||
"source-map-support": "^0.5.20",
|
||||
"supertest": "^6.1.3",
|
||||
"ts-jest": "^27.0.3",
|
||||
"ts-loader": "^9.2.3",
|
||||
"ts-node": "^10.0.0",
|
||||
"tsconfig-paths": "^3.10.1",
|
||||
"typescript": "^4.3.5"
|
||||
"ts-loader": "^9.2.7",
|
||||
"ts-node": "^10.7.0",
|
||||
"tsconfig-paths": "^3.13.0",
|
||||
"typescript": "^4.6.2"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
|
||||
+83
-38
@@ -1,44 +1,89 @@
|
||||
import { MiddlewareConsumer, Module, NestModule, RequestMethod } from '@nestjs/common';
|
||||
import { InputGrpcClientModule } from './inputs/input-grpc-client.module';
|
||||
import { UsersGrpcClientModule } from './users-grpc-client/users-grpc-client.module';
|
||||
import { OutputsModule } from './outputs/outputs.module';
|
||||
import { EnrichmentModule } from './enrichment/enrichment.module';
|
||||
import { TransformationsModule } from './transformations/transformations.module';
|
||||
import { PipelinesModule } from './pipelines/pipelines.module';
|
||||
import { RestInputsModule } from './rest/rest-inputs/rest-inputs.module';
|
||||
import { RestOutputsModule } from './rest/rest-outputs/rest-outputs.module';
|
||||
import { RestEnrichmentsModule } from './rest/rest-enrichments/rest-enrichments.module';
|
||||
import { RestTransformationsModule } from './rest/rest-transformations/rest-transformations.module';
|
||||
import { RestPipelinesModule } from './rest/rest-pipelines/rest-pipelines.module';
|
||||
import { RestUserModule } from './rest/rest-user/rest-user.module';
|
||||
import { RestFactoryModule } from './rest/rest-factory/rest-factory.module';
|
||||
import { LoggerMiddleware } from './middlewares/authentication';
|
||||
import { RestInputsController } from './rest/rest-inputs/rest-inputs.controller';
|
||||
import { RestOutputsController } from './rest/rest-outputs/rest-outputs.controller';
|
||||
import { RestTransformationsController } from './rest/rest-transformations/rest-transformations.controller';
|
||||
import { RestPipelinesController } from './rest/rest-pipelines/rest-pipelines.controller';
|
||||
import { RestEnrichmentsController } from './rest/rest-enrichments/rest-enrichments.controller';
|
||||
import { RestFactoryController } from './rest/rest-factory/rest-factory.controller';
|
||||
import { HealthModule } from './health/health.module';
|
||||
@Module({
|
||||
imports: [
|
||||
RestInputsModule, RestOutputsModule, RestEnrichmentsModule, RestTransformationsModule, RestPipelinesModule, RestUserModule, RestFactoryModule, HealthModule,
|
||||
// InputGrpcClientModule,
|
||||
//OutputsModule,
|
||||
//EnrichmentModule,
|
||||
//TransformationsModule,
|
||||
//PipelinesModule
|
||||
],
|
||||
controllers: [],
|
||||
providers: [],
|
||||
})
|
||||
export class AppModule implements NestModule{
|
||||
import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
|
||||
import { ClientsModule } from '@nestjs/microservices';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
|
||||
import { LoggerMiddleware } from './middlewares/authentication';
|
||||
|
||||
// import { InputsController } from './modules/inputs/inputs.controller';
|
||||
// import { TransformationsController } from './modules/transformations/transformations.controller';
|
||||
// import { OutputsController } from './modules/outputs/outputs.controllers';
|
||||
// import { PipelinesController } from './modules/pipelines/pipelines.controller';
|
||||
import { AuthController } from './modules/auth/auth.controller';
|
||||
|
||||
import { InputsService } from './modules/inputs/inputs.service';
|
||||
import { TransformationsService } from './modules/transformations/transformations.service';
|
||||
import { OutputsService } from './modules/outputs/outputs.service';
|
||||
// import { PipelinesService } from './modules/pipelines/pipelines.service';
|
||||
// import { AuthService } from './modules/auth/auth.service';
|
||||
|
||||
// import { InputsClientService } from './clients/inputs/client.service';
|
||||
// import { TransformationsClientService } from './clients/transformations/client.service';
|
||||
// import { OutputsClientService } from './clients/outputs/client.service';
|
||||
// import { PipelinesClientService } from './clients/pipelines/client.service';
|
||||
import { AuthClientService } from './clients/auth/client.service';
|
||||
|
||||
// import { InputsClientConfiguration } from './clients/inputs/client.config';
|
||||
// import { OutputsClientConfiguration } from './clients/outputs/client.config';
|
||||
// import { TransformationsClientConfiguration } from './clients/transformations/client.config';
|
||||
import { AuthClient } from './clients/auth/client.config';
|
||||
|
||||
const authClient = new AuthClient();
|
||||
|
||||
@Module({
|
||||
controllers: [
|
||||
// InputsController,
|
||||
// TransformationsController,
|
||||
// OutputsController,
|
||||
// PipelinesController,
|
||||
AuthController,
|
||||
],
|
||||
providers: [
|
||||
InputsService,
|
||||
TransformationsService,
|
||||
OutputsService,
|
||||
// PipelinesService,
|
||||
// AuthService,
|
||||
// InputsClientService,
|
||||
// TransformationsClientService,
|
||||
// OutputsClientService,
|
||||
// PipelinesClientService,
|
||||
AuthClientService,
|
||||
],
|
||||
imports: [
|
||||
ConfigModule.forRoot({
|
||||
isGlobal: true,
|
||||
}),
|
||||
|
||||
ClientsModule.register([
|
||||
// {
|
||||
// name: 'INPUTS_PACKAGE',
|
||||
// ...InputsClientConfiguration,
|
||||
// },
|
||||
|
||||
// {
|
||||
// name: 'TRANSFORMATIONS_PACKAGE',
|
||||
// ...TransformationsClientConfiguration,
|
||||
// },
|
||||
// {
|
||||
// name: 'OUTPUTS_PACKAGE',
|
||||
// ...OutputsClientConfiguration,
|
||||
// },
|
||||
{
|
||||
name: 'AUTH_PACKAGE',
|
||||
...authClient.config(),
|
||||
},
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class AppModule implements NestModule {
|
||||
configure(consumer: MiddlewareConsumer) {
|
||||
consumer
|
||||
.apply(LoggerMiddleware)
|
||||
.forRoutes(RestInputsController,RestOutputsController,RestTransformationsController,RestPipelinesController,RestEnrichmentsController,RestFactoryController)
|
||||
.forRoutes
|
||||
// InputsController,
|
||||
// TransformationsController,
|
||||
// OutputsController,
|
||||
// PipelinesController,
|
||||
();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { credentials } from '@grpc/grpc-js';
|
||||
import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||
|
||||
import { DucProtofile } from '@victorradael/protospack';
|
||||
|
||||
export class AuthClient {
|
||||
config(): ClientOptions {
|
||||
return {
|
||||
transport: Transport.GRPC,
|
||||
options: {
|
||||
url: process.env.DUC_URL,
|
||||
package: 'duc',
|
||||
credentials: credentials.createSsl(),
|
||||
protoPath: DucProtofile,
|
||||
loader: {
|
||||
enums: String,
|
||||
objects: true,
|
||||
arrays: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import { OnModuleInit, Inject } from '@nestjs/common';
|
||||
import { ClientGrpc } from '@nestjs/microservices';
|
||||
|
||||
import { CognitoServiceInterface } from '@victorradael/protospack';
|
||||
|
||||
import { ILogin } from './interfaces';
|
||||
|
||||
export class AuthClientService implements OnModuleInit {
|
||||
private cognitoService: CognitoServiceInterface;
|
||||
constructor(
|
||||
@Inject('AUTH_PACKAGE') private readonly grpcClient: ClientGrpc,
|
||||
) {}
|
||||
|
||||
onModuleInit() {
|
||||
this.cognitoService = this.grpcClient.getService<CognitoServiceInterface>(
|
||||
'CognitoProtoService',
|
||||
);
|
||||
}
|
||||
|
||||
async signIn({ username, password }: ILogin): Promise<any> {
|
||||
console.log('CognitoClientService', 'SignIn');
|
||||
|
||||
const tokens = await new Promise((resolve, reject) => {
|
||||
this.cognitoService.signIn({ 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;
|
||||
}
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
export interface ILogin {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// import { join } from 'path';
|
||||
// import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||
|
||||
// export const InputsClientConfiguration: ClientOptions = {
|
||||
// transport: Transport.GRPC,
|
||||
// options: {
|
||||
// //url: `${process.env.USERS_SVC_URL}:${process.env.USERS_SVC_PORT}`,
|
||||
// url: `127.0.0.1:50052`,
|
||||
// package: 'input',
|
||||
// protoPath: join(__dirname, '..', 'proto', 'input.proto'),
|
||||
// loader: {
|
||||
// enums: String,
|
||||
// objects: true,
|
||||
// arrays: true,
|
||||
// },
|
||||
// },
|
||||
// };
|
||||
@@ -0,0 +1,64 @@
|
||||
// import {
|
||||
// Get,
|
||||
// Post,
|
||||
// Controller,
|
||||
// Delete,
|
||||
// OnModuleInit,
|
||||
// Put,
|
||||
// Param,
|
||||
// } from '@nestjs/common';
|
||||
// import { Client, ClientGrpc, Payload } from '@nestjs/microservices';
|
||||
// import { CreateInputGrpcClientDto } from './dto/create-input-grpc-client.dto';
|
||||
// import { UpdateInputGrpcClientDto } from './dto/update-input-grpc-client.dto';
|
||||
// import { InputGrpcClientService } from './input-grpc-client.service';
|
||||
// import { GrpcClientConfiguration } from './client.config';
|
||||
// import { TestConnectionDTO } from './dto/test-connection-grpc-client.dto';
|
||||
// import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
// @Controller('grpc/input')
|
||||
// export class InputsClientService implements OnModuleInit {
|
||||
// @Client(GrpcClientConfiguration)
|
||||
// private inputServiceClient: ClientGrpc;
|
||||
|
||||
// private inputService: InputGrpcClientService;
|
||||
|
||||
// onModuleInit() {
|
||||
// this.inputService =
|
||||
// this.inputServiceClient.getService<InputGrpcClientService>(
|
||||
// 'InputService',
|
||||
// );
|
||||
// }
|
||||
|
||||
// @Post()
|
||||
// async create(@Payload() createInputDto: CreateInputGrpcClientDto) {
|
||||
// return this.inputService.create(createInputDto);
|
||||
// }
|
||||
|
||||
// @Get()
|
||||
// list() {
|
||||
// return this.inputService.list();
|
||||
// }
|
||||
|
||||
// @Get(':id')
|
||||
// show(@Param() id: string) {
|
||||
// return this.inputService.show(id);
|
||||
// }
|
||||
|
||||
// @Put(':id')
|
||||
// update(
|
||||
// @Payload() updateInputDto: UpdateInputGrpcClientDto,
|
||||
// @Param() id: string,
|
||||
// ) {
|
||||
// return this.inputService.update(id, updateInputDto);
|
||||
// }
|
||||
|
||||
// @Delete(':id')
|
||||
// remove(@Param() id: string) {
|
||||
// return this.inputService.remove(id);
|
||||
// }
|
||||
|
||||
// @Get('/test-connection')
|
||||
// testConnection(@Payload() testConnectionDTO: TestConnectionDTO) {
|
||||
// return this.inputService.testConnection(testConnectionDTO);
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,17 @@
|
||||
// import { join } from 'path';
|
||||
// import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||
|
||||
// export const OutputsClientConfiguration: ClientOptions = {
|
||||
// transport: Transport.GRPC,
|
||||
// options: {
|
||||
// //url: `${process.env.USERS_SVC_URL}:${process.env.USERS_SVC_PORT}`,
|
||||
// url: `127.0.0.1:50053`,
|
||||
// package: 'output',
|
||||
// protoPath: join(__dirname, '..', 'proto', 'output.proto'),
|
||||
// loader: {
|
||||
// enums: String,
|
||||
// objects: true,
|
||||
// arrays: true,
|
||||
// },
|
||||
// },
|
||||
// };
|
||||
@@ -0,0 +1,57 @@
|
||||
// import {
|
||||
// Controller,
|
||||
// Delete,
|
||||
// Get,
|
||||
// OnModuleInit,
|
||||
// Param,
|
||||
// Post,
|
||||
// Put,
|
||||
// } from '@nestjs/common';
|
||||
// import {
|
||||
// Client,
|
||||
// ClientGrpc,
|
||||
// MessagePattern,
|
||||
// Payload,
|
||||
// } from '@nestjs/microservices';
|
||||
// import { OutputsService } from './outputs.service';
|
||||
// import { CreateOutputDto } from './dto/create-output.dto';
|
||||
// import { UpdateOutputDto } from './dto/update-output.dto';
|
||||
// import { ApiTags } from '@nestjs/swagger';
|
||||
// import { GrpcClientConfiguration } from './client.config';
|
||||
|
||||
// @Controller('output')
|
||||
// export class OutputsClientService implements OnModuleInit {
|
||||
// @Client(GrpcClientConfiguration)
|
||||
// private outputServiceClient: ClientGrpc;
|
||||
|
||||
// private outputService: OutputsService;
|
||||
|
||||
// onModuleInit() {
|
||||
// this.outputService =
|
||||
// this.outputServiceClient.getService<OutputsService>('OutputService');
|
||||
// }
|
||||
// @Post()
|
||||
// create(@Payload() createOutputDto: CreateOutputDto) {
|
||||
// return this.outputService.create(createOutputDto);
|
||||
// }
|
||||
|
||||
// @Get()
|
||||
// list() {
|
||||
// return this.outputService.list();
|
||||
// }
|
||||
|
||||
// @Get(':id')
|
||||
// show(@Param() id: string) {
|
||||
// return this.outputService.show(id);
|
||||
// }
|
||||
|
||||
// @Put(':id')
|
||||
// update(@Param() id: string, @Payload() updateOutputDto: UpdateOutputDto) {
|
||||
// return this.outputService.update(id, updateOutputDto);
|
||||
// }
|
||||
|
||||
// @Delete(':id')
|
||||
// remove(@Param() id: string) {
|
||||
// return this.outputService.remove(id);
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,17 @@
|
||||
// import { join } from 'path';
|
||||
// import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||
|
||||
// export const PipelinesClientConfiguration: ClientOptions = {
|
||||
// transport: Transport.GRPC,
|
||||
// options: {
|
||||
// //url: `${process.env.USERS_SVC_URL}:${process.env.USERS_SVC_PORT}`,
|
||||
// url: `127.0.0.1:50054`,
|
||||
// package: 'pipeline',
|
||||
// protoPath: join(__dirname, '..', 'proto', 'pipeline.proto'),
|
||||
// loader: {
|
||||
// enums: String,
|
||||
// objects: true,
|
||||
// arrays: true,
|
||||
// },
|
||||
// },
|
||||
// };
|
||||
@@ -0,0 +1,68 @@
|
||||
// import {
|
||||
// Controller,
|
||||
// Delete,
|
||||
// Get,
|
||||
// OnModuleInit,
|
||||
// Param,
|
||||
// Post,
|
||||
// Put,
|
||||
// } from '@nestjs/common';
|
||||
// import {
|
||||
// Client,
|
||||
// ClientGrpc,
|
||||
// MessagePattern,
|
||||
// Payload,
|
||||
// } from '@nestjs/microservices';
|
||||
// import { PipelinesService } from './pipelines.service';
|
||||
// import { CreatePipelineDto } from './dto/create-pipeline.dto';
|
||||
// import { UpdatePipelineDto } from './dto/update-pipeline.dto';
|
||||
// import { GrpcClientConfiguration } from './client.config';
|
||||
|
||||
// @Controller('pipeline')
|
||||
// export class PipelinesClientService implements OnModuleInit {
|
||||
// @Client(GrpcClientConfiguration)
|
||||
// private pipelineServiceClient: ClientGrpc;
|
||||
|
||||
// private pipelineService: PipelinesService;
|
||||
|
||||
// onModuleInit() {
|
||||
// this.pipelineService =
|
||||
// this.pipelineServiceClient.getService<PipelinesService>(
|
||||
// 'PipelineService',
|
||||
// );
|
||||
// }
|
||||
|
||||
// @Post()
|
||||
// create(@Payload() createPipelineDto: CreatePipelineDto) {
|
||||
// return this.pipelineService.create(createPipelineDto);
|
||||
// }
|
||||
|
||||
// @Get()
|
||||
// list() {
|
||||
// return this.pipelineService.list();
|
||||
// }
|
||||
|
||||
// @Get(':id')
|
||||
// show(@Param() id: string) {
|
||||
// return this.pipelineService.show(id);
|
||||
// }
|
||||
|
||||
// @Put(':id')
|
||||
// update(@Param() id: string, @Payload() updatePipelineDto: UpdatePipelineDto) {
|
||||
// return this.pipelineService.update(id, updatePipelineDto);
|
||||
// }
|
||||
|
||||
// @Delete()
|
||||
// remove(@Param() id: string) {
|
||||
// return this.pipelineService.remove(id);
|
||||
// }
|
||||
|
||||
// @Post()
|
||||
// getPipelineLogsMessages(@Param() id: string, @Payload() details: string) {
|
||||
// return this.pipelineService.getPipelineLogsMessages(id, details);
|
||||
// }
|
||||
|
||||
// getPipelineStatus(id: string) {
|
||||
// return this.pipelineService.getPipelineStatus(id);
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,17 @@
|
||||
// import { join } from 'path';
|
||||
// import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||
|
||||
// export const TransformationsClientConfiguration: ClientOptions = {
|
||||
// transport: Transport.GRPC,
|
||||
// options: {
|
||||
// //url: `${process.env.USERS_SVC_URL}:${process.env.USERS_SVC_PORT}`,
|
||||
// url: `127.0.0.1:50054`,
|
||||
// package: 'transformation',
|
||||
// protoPath: join(__dirname, '..', 'proto', 'transformation.proto'),
|
||||
// loader: {
|
||||
// enums: String,
|
||||
// objects: true,
|
||||
// arrays: true,
|
||||
// },
|
||||
// },
|
||||
// };
|
||||
@@ -0,0 +1,65 @@
|
||||
// import {
|
||||
// Controller,
|
||||
// Delete,
|
||||
// Get,
|
||||
// OnModuleInit,
|
||||
// Param,
|
||||
// Post,
|
||||
// Put,
|
||||
// } from '@nestjs/common';
|
||||
// import {
|
||||
// Client,
|
||||
// ClientGrpc,
|
||||
// MessagePattern,
|
||||
// Payload,
|
||||
// } from '@nestjs/microservices';
|
||||
// import { TransformationsService } from './transformations.service';
|
||||
// import { CreateTransformationDto } from './dto/create-transformation.dto';
|
||||
// import { UpdateTransformationDto } from './dto/update-transformation.dto';
|
||||
// import { ApiTags } from '@nestjs/swagger';
|
||||
// import { GrpcClientConfiguration } from './client.config';
|
||||
|
||||
// @Controller('transformation')
|
||||
// export class TransformationsClientService implements OnModuleInit {
|
||||
// @Client(GrpcClientConfiguration)
|
||||
// private transformationServiceClient: ClientGrpc;
|
||||
|
||||
// private transformationService: TransformationsService;
|
||||
|
||||
// onModuleInit() {
|
||||
// this.transformationService =
|
||||
// this.transformationServiceClient.getService<TransformationsService>(
|
||||
// 'TransformationService',
|
||||
// );
|
||||
// }
|
||||
|
||||
// @Post()
|
||||
// create(@Payload() createTransformationDto: CreateTransformationDto[]) {
|
||||
// return createTransformationDto.map((transf) =>
|
||||
// this.transformationService.create(transf),
|
||||
// );
|
||||
// }
|
||||
|
||||
// @Get()
|
||||
// list() {
|
||||
// return this.transformationService.list();
|
||||
// }
|
||||
|
||||
// @Get(':id')
|
||||
// show(@Payload() id: string) {
|
||||
// return this.transformationService.show(id);
|
||||
// }
|
||||
|
||||
// @Put(':id')
|
||||
// update(
|
||||
// @Param() id: string,
|
||||
// @Payload() updateTransformationDto: UpdateTransformationDto,
|
||||
// ) {
|
||||
// return this.transformationService.update(id, updateTransformationDto);
|
||||
// }
|
||||
|
||||
// @Delete(':id')
|
||||
// remove(@Param() id: string) {
|
||||
// return this.transformationService.remove(id);
|
||||
// }
|
||||
// }
|
||||
@@ -1,17 +0,0 @@
|
||||
import { join } from 'path';
|
||||
import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||
|
||||
export const GrpcClientConfiguration: ClientOptions = {
|
||||
transport: Transport.GRPC,
|
||||
options: {
|
||||
//url: `${process.env.USERS_SVC_URL}:${process.env.USERS_SVC_PORT}`,
|
||||
url: `127.0.0.1:50053`,
|
||||
package: 'enrichment',
|
||||
protoPath: join(__dirname, '..', 'proto', 'enrichment.proto'),
|
||||
loader: {
|
||||
enums: String,
|
||||
objects: true,
|
||||
arrays: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
export class CreateEnrichmentDto {
|
||||
|
||||
type:string;
|
||||
|
||||
columns:string[]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
import { PartialType } from '@nestjs/mapped-types';
|
||||
import { CreateEnrichmentDto } from './create-enrichment.dto';
|
||||
|
||||
export class UpdateEnrichmentDto extends PartialType(CreateEnrichmentDto) {
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { EnrichmentController } from './enrichment.controller';
|
||||
import { EnrichmentsService } from './enrichment.service';
|
||||
|
||||
describe('EnrichmentController', () => {
|
||||
let controller: EnrichmentController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [EnrichmentController],
|
||||
providers: [EnrichmentsService],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<EnrichmentController>(EnrichmentController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,60 +0,0 @@
|
||||
import {
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
OnModuleInit,
|
||||
Param,
|
||||
Post,
|
||||
Put,
|
||||
} from '@nestjs/common';
|
||||
import { Client, ClientGrpc, Payload } from '@nestjs/microservices';
|
||||
import { EnrichmentsService } from './enrichment.service';
|
||||
import { CreateEnrichmentDto } from './dto/create-enrichment.dto';
|
||||
import { UpdateEnrichmentDto } from './dto/update-enrichment.dto';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { GrpcClientConfiguration } from './config/grpc-client';
|
||||
|
||||
@ApiTags('enrichments')
|
||||
@Controller('enrichment')
|
||||
export class EnrichmentController implements OnModuleInit {
|
||||
|
||||
@Client(GrpcClientConfiguration)
|
||||
private enrichmentServiceClient: ClientGrpc;
|
||||
|
||||
private enrichmentService: EnrichmentsService;
|
||||
|
||||
onModuleInit() {
|
||||
this.enrichmentService =
|
||||
this.enrichmentServiceClient.getService<EnrichmentsService>(
|
||||
'EnrichmentService',
|
||||
);
|
||||
}
|
||||
|
||||
@Post()
|
||||
create(@Payload() createEnrichmentDto: CreateEnrichmentDto) {
|
||||
return this.enrichmentService.create(createEnrichmentDto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
list() {
|
||||
return this.enrichmentService.list();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
show(@Param() id: string) {
|
||||
return this.enrichmentService.show(id);
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
update(
|
||||
@Param() id: string,
|
||||
@Payload() updateEnrichmentDto: UpdateEnrichmentDto,
|
||||
) {
|
||||
return this.enrichmentService.update(id, updateEnrichmentDto);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
remove(@Param() id: string) {
|
||||
return this.enrichmentService.remove(id);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { EnrichmentsService } from './enrichment.service';
|
||||
import { EnrichmentController } from './enrichment.controller';
|
||||
|
||||
@Module({
|
||||
controllers: [EnrichmentController],
|
||||
providers: [EnrichmentsService],
|
||||
})
|
||||
export class EnrichmentModule {}
|
||||
@@ -1,18 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { EnrichmentsService } from './enrichment.service';
|
||||
|
||||
describe('EnrichmentService', () => {
|
||||
let service: EnrichmentsService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [EnrichmentsService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<EnrichmentsService>(EnrichmentsService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,26 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { CreateEnrichmentDto } from './dto/create-enrichment.dto';
|
||||
import { UpdateEnrichmentDto } from './dto/update-enrichment.dto';
|
||||
|
||||
@Injectable()
|
||||
export class EnrichmentsService {
|
||||
create(createEnrichmentDto: CreateEnrichmentDto) {
|
||||
return 'This action adds a new enrichment';
|
||||
}
|
||||
|
||||
list() {
|
||||
return `This action returns all enrichment`;
|
||||
}
|
||||
|
||||
show(id: string) {
|
||||
return `This action returns a #${id} enrichment`;
|
||||
}
|
||||
|
||||
update(id: string, updateEnrichmentDto: UpdateEnrichmentDto) {
|
||||
return `This action updates a #${id} enrichment`;
|
||||
}
|
||||
|
||||
remove(id: string) {
|
||||
return `This action removes a #${id} enrichment`;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
export class Enrichment {
|
||||
|
||||
id:string;
|
||||
|
||||
type:string;
|
||||
|
||||
columns:string[]
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package enrichment;
|
||||
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
|
||||
|
||||
service EnrichmentService {
|
||||
rpc Create(CreateEnrichmentRequest) returns (Enrichment) {}
|
||||
rpc Show(IdRequest) returns (Enrichment) {}
|
||||
rpc List(Empty) returns (ListResponse){}
|
||||
rpc Update(UpdateEnrichmentRequest) returns (Enrichment){}
|
||||
rpc Remove(IdRequest) returns (Empty){}
|
||||
}
|
||||
|
||||
message Empty {}
|
||||
|
||||
message IdRequest{
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message UpdateEnrichmentRequest{
|
||||
string id = 1;
|
||||
string type = 2;
|
||||
repeated string columns = 3;
|
||||
}
|
||||
|
||||
message Enrichment {
|
||||
string id = 1;
|
||||
string type = 2;
|
||||
repeated string columns = 3;
|
||||
}
|
||||
|
||||
message CreateEnrichmentRequest {
|
||||
string type = 1;
|
||||
repeated string columns = 2;
|
||||
}
|
||||
|
||||
message ListResponse {
|
||||
repeated Enrichment enrichments = 2;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export class Health {}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { HealthService } from './health.service';
|
||||
import { HealthController } from './health.controller';
|
||||
|
||||
@Module({
|
||||
controllers: [HealthController],
|
||||
providers: [HealthService],
|
||||
})
|
||||
export class HealthModule {}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { join } from 'path';
|
||||
import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||
|
||||
export const GrpcClientConfiguration: ClientOptions = {
|
||||
transport: Transport.GRPC,
|
||||
options: {
|
||||
//url: `${process.env.USERS_SVC_URL}:${process.env.USERS_SVC_PORT}`,
|
||||
url: `127.0.0.1:50052`,
|
||||
package: 'input',
|
||||
protoPath: join(__dirname, '..', 'proto', 'input.proto'),
|
||||
loader: {
|
||||
enums: String,
|
||||
objects: true,
|
||||
arrays: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
export class CreateInputGrpcClientDto {
|
||||
|
||||
cron:string;
|
||||
|
||||
name:string;
|
||||
|
||||
plugin:string;
|
||||
|
||||
values:string;
|
||||
|
||||
operation:string;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
export class TestConnectionDTO{
|
||||
|
||||
values:string;
|
||||
plugin:string;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
import { PartialType } from '@nestjs/mapped-types';
|
||||
import { CreateInputGrpcClientDto } from './create-input-grpc-client.dto';
|
||||
|
||||
export class UpdateInputGrpcClientDto extends PartialType(
|
||||
CreateInputGrpcClientDto,
|
||||
) {}
|
||||
@@ -1,14 +0,0 @@
|
||||
export class InputGrpcClient {
|
||||
|
||||
id:string;
|
||||
|
||||
cron:string;
|
||||
|
||||
name:string;
|
||||
|
||||
plugin:string;
|
||||
|
||||
values:string;
|
||||
|
||||
operation:string;
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
import {
|
||||
Get,
|
||||
Post,
|
||||
Controller,
|
||||
Delete,
|
||||
OnModuleInit,
|
||||
Put,
|
||||
Param
|
||||
} from '@nestjs/common';
|
||||
import { Client, ClientGrpc, Payload } from '@nestjs/microservices';
|
||||
import { CreateInputGrpcClientDto } from './dto/create-input-grpc-client.dto';
|
||||
import { UpdateInputGrpcClientDto } from './dto/update-input-grpc-client.dto';
|
||||
import { InputGrpcClientService } from './input-grpc-client.service';
|
||||
import { GrpcClientConfiguration } from './config/grpc-client';
|
||||
import { TestConnectionDTO } from './dto/test-connection-grpc-client.dto';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@Controller('grpc/input')
|
||||
export class InputGrpcClientController implements OnModuleInit {
|
||||
@Client(GrpcClientConfiguration)
|
||||
private inputServiceClient: ClientGrpc;
|
||||
|
||||
private inputService: InputGrpcClientService;
|
||||
|
||||
onModuleInit() {
|
||||
this.inputService =
|
||||
this.inputServiceClient.getService<InputGrpcClientService>('InputService');
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(@Payload() createInputDto: CreateInputGrpcClientDto) {
|
||||
return this.inputService.create(createInputDto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
list() {
|
||||
return this.inputService.list();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
show(@Param() id: string) {
|
||||
return this.inputService.show(id);
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
update(
|
||||
@Payload() updateInputDto: UpdateInputGrpcClientDto,
|
||||
@Param() id: string,
|
||||
) {
|
||||
return this.inputService.update(id, updateInputDto);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
remove(@Param() id: string) {
|
||||
return this.inputService.remove(id);
|
||||
}
|
||||
|
||||
@Get('/test-connection')
|
||||
testConnection(@Payload() testConnectionDTO:TestConnectionDTO){
|
||||
|
||||
return this.inputService.testConnection(testConnectionDTO)
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { InputGrpcClientService } from './input-grpc-client.service';
|
||||
import { InputGrpcClientController } from './input-grpc-client.controller';
|
||||
// import { InputRestClientController } from './input-rest-client.controller';
|
||||
|
||||
@Module({
|
||||
controllers: [
|
||||
InputGrpcClientController,
|
||||
// InputRestClientController
|
||||
],
|
||||
providers: [InputGrpcClientService],
|
||||
})
|
||||
export class InputGrpcClientModule {}
|
||||
@@ -1,18 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { InputGrpcClientService } from './input-grpc-client.service';
|
||||
|
||||
describe('InputGrcpClientService', () => {
|
||||
let service: InputGrpcClientService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [InputGrpcClientService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<InputGrpcClientService>(InputGrpcClientService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,31 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { CreateInputGrpcClientDto } from './dto/create-input-grpc-client.dto';
|
||||
import { TestConnectionDTO } from './dto/test-connection-grpc-client.dto';
|
||||
import { UpdateInputGrpcClientDto } from './dto/update-input-grpc-client.dto';
|
||||
|
||||
@Injectable()
|
||||
export class InputGrpcClientService {
|
||||
create(createInputGrcpClientDto: CreateInputGrpcClientDto) {
|
||||
return 'This action adds a new InputGrcpClient';
|
||||
}
|
||||
|
||||
list() {
|
||||
return `This action returns all InputGrcpClient`;
|
||||
}
|
||||
|
||||
show(id: string) {
|
||||
return `This action returns a #${id} InputGrcpClient`;
|
||||
}
|
||||
|
||||
update(id: string, updateInputGrcpClientDto: UpdateInputGrpcClientDto) {
|
||||
return `This action updates a #${id} InputGrcpClient`;
|
||||
}
|
||||
|
||||
remove(id: string) {
|
||||
return `This action removes a #${id} InputGrcpClient`;
|
||||
}
|
||||
|
||||
testConnection(testConnectionDTO:TestConnectionDTO){
|
||||
return `This action tests a given connection`;
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
import { Body, Controller, Delete, Get, Param, Post, Put, Redirect } from '@nestjs/common';
|
||||
import { Payload } from '@nestjs/microservices';
|
||||
import axios from 'axios';
|
||||
import { Console } from 'console';
|
||||
import { CreateInputGrpcClientDto } from './dto/create-input-grpc-client.dto';
|
||||
import { UpdateInputGrpcClientDto } from './dto/update-input-grpc-client.dto';
|
||||
|
||||
@Controller('input')
|
||||
export class InputRestClientController {
|
||||
|
||||
|
||||
@Get('/test-connection/')
|
||||
async testConnection(){
|
||||
console.log(process.env.DEV_URL+`/test-connection`, "ON TEST CONNECTION ROUTE")
|
||||
await axios.get(process.env.DEV_URL+`/test-connection`).then( (response) => {
|
||||
return response
|
||||
})
|
||||
}
|
||||
|
||||
@Post()
|
||||
async create(@Body() createInputDto: CreateInputGrpcClientDto){
|
||||
console.log(createInputDto)
|
||||
console.log(process.env.DEV_URL+`/input`, "ON CREATE ROUTE")
|
||||
|
||||
await axios.post(process.env.DEV_URL+'/input',createInputDto).then( (response) => {
|
||||
return response
|
||||
})
|
||||
}
|
||||
|
||||
@Get()
|
||||
async list(){
|
||||
console.log(process.env.DEV_URL+`/input`, "ON GET ROUTE")
|
||||
await axios.get(process.env.DEV_URL+`/input`).then( (response) => {
|
||||
return response
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@Get('/:id')
|
||||
async show(@Param() id: string){
|
||||
console.log(process.env.DEV_URL+`/input/${id}`, "ON SHOW ROUTE")
|
||||
await axios.get(process.env.DEV_URL+`/input/${id}`).then( (response) => {
|
||||
return response
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@Put(':id')
|
||||
async update(
|
||||
@Payload() updateInputDto: UpdateInputGrpcClientDto,
|
||||
@Param() id: string,
|
||||
){
|
||||
console.log(process.env.DEV_URL+`/input/${id}`, "ON UPDATE ROUTE")
|
||||
await axios.put(process.env.DEV_URL+`input/${id}`,updateInputDto).then( (response) => {
|
||||
return response
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@Delete(':id')
|
||||
async delete(@Param() id: string){
|
||||
console.log(process.env.DEV_URL+`/input/${id}`, "ON DELETE ROUTE")
|
||||
|
||||
await axios.delete(process.env.DEV_URL+`/input/${id}`).then( (response) => {
|
||||
return response
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package input;
|
||||
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
|
||||
|
||||
service InputService {
|
||||
rpc Create(CreateInputRequest) returns (Input) {}
|
||||
rpc Show(IdRequest) returns (Input) {}
|
||||
rpc List(Empty) returns (ListResponse){}
|
||||
rpc Update(UpdateInputRequest) returns (Input){}
|
||||
rpc Remove(IdRequest) returns (Empty){}
|
||||
rpc TestConnection(TestConnectionRequest) returns (TestConnectionResponse){}
|
||||
}
|
||||
|
||||
message Empty {}
|
||||
|
||||
message IdRequest{
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message UpdateInputRequest{
|
||||
string id = 1;
|
||||
string cron = 2;
|
||||
string name = 3;
|
||||
string plugin = 4;
|
||||
string values = 5;
|
||||
string operation = 6;
|
||||
}
|
||||
|
||||
message Input {
|
||||
string id = 1;
|
||||
string cronFormated = 2;
|
||||
string name = 3;
|
||||
string plugin = 4;
|
||||
string values = 5;
|
||||
string operation = 6;
|
||||
}
|
||||
|
||||
message CreateInputRequest {
|
||||
string cron = 1;
|
||||
string name = 2;
|
||||
string plugin = 3;
|
||||
string values = 4;
|
||||
string operation = 5;
|
||||
}
|
||||
|
||||
message ListResponse {
|
||||
repeated Input inputs = 1;
|
||||
}
|
||||
|
||||
message TestConnectionRequest{
|
||||
string values = 1;
|
||||
string plugin = 2;
|
||||
}
|
||||
|
||||
message TestConnectionResponse{
|
||||
|
||||
// nao sei como vai ser a resposta
|
||||
bool respose = 1;
|
||||
|
||||
}
|
||||
+1
-2
@@ -3,8 +3,7 @@ import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||
import { writeFileSync } from 'fs';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
import { config } from 'dotenv';
|
||||
config();
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
|
||||
|
||||
@@ -2,29 +2,22 @@ import { Request, Response, NextFunction } from 'express';
|
||||
import axios from 'axios';
|
||||
import { NestMiddleware } from '@nestjs/common';
|
||||
|
||||
export class LoggerMiddleware implements NestMiddleware{
|
||||
|
||||
|
||||
use = async (
|
||||
request: Request,
|
||||
response: Response,
|
||||
next: NextFunction
|
||||
) => {
|
||||
|
||||
try {
|
||||
const verify_response = await axios.post(
|
||||
`${process.env.DEV_URL}/user/verify`,
|
||||
{ "token":request.get('Authorization')}
|
||||
).then(response =>{
|
||||
if(response.data.message == "Success"){
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
} catch (error) {
|
||||
response.status(401).send({ message: 'Authentication Failed!' });
|
||||
}
|
||||
};
|
||||
export class LoggerMiddleware implements NestMiddleware {
|
||||
use = async (request: Request, response: Response, next: NextFunction) => {
|
||||
try {
|
||||
const verify_response = await axios
|
||||
.post(`${process.env.DEV_URL}/user/verify`, {
|
||||
token: request.get('Authorization'),
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.data.message == 'Success') {
|
||||
next();
|
||||
}
|
||||
});
|
||||
|
||||
console.log(verify_response);
|
||||
} catch (error) {
|
||||
response.status(401).send({ message: 'Authentication Failed!' });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import { Body, Controller, Post } from '@nestjs/common';
|
||||
|
||||
import { AuthClientService } from 'src/clients/auth/client.service';
|
||||
|
||||
interface ISignIn {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
constructor(private authClient: AuthClientService) {}
|
||||
|
||||
@Post()
|
||||
async signIn(@Body() { username, password }: ISignIn) {
|
||||
console.log(`/auth`, 'SignIn');
|
||||
|
||||
const tokens = await this.authClient
|
||||
.signIn({ username, password })
|
||||
.then((result) => result)
|
||||
.catch((err) => console.log(err));
|
||||
|
||||
return tokens;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// import {
|
||||
// Body,
|
||||
// Controller,
|
||||
// Delete,
|
||||
// Get,
|
||||
// Param,
|
||||
// Post,
|
||||
// Put,
|
||||
// Redirect,
|
||||
// } from '@nestjs/common';
|
||||
// import { Payload } from '@nestjs/microservices';
|
||||
// import axios from 'axios';
|
||||
// import { Console } from 'console';
|
||||
// // import { CreateInputGrpcClientDto } from './dto/create-input-grpc-client.dto';
|
||||
// // import { UpdateInputGrpcClientDto } from './dto/update-input-grpc-client.dto';
|
||||
|
||||
// @Controller('input')
|
||||
// export class InputsController {
|
||||
// @Get('/test-connection')
|
||||
// async testConnection() {
|
||||
// console.log(
|
||||
// process.env.DEV_URL + `/test-connection`,
|
||||
// 'ON TEST CONNECTION ROUTE',
|
||||
// );
|
||||
// await axios
|
||||
// .get(process.env.DEV_URL + `/test-connection`)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Post()
|
||||
// async create(@Body() createInputDto: CreateInputGrpcClientDto) {
|
||||
// console.log(createInputDto);
|
||||
// console.log(process.env.DEV_URL + `/input`, 'ON CREATE ROUTE');
|
||||
|
||||
// await axios
|
||||
// .post(process.env.DEV_URL + '/input', createInputDto)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Get()
|
||||
// async list() {
|
||||
// console.log(process.env.DEV_URL + `/input`, 'ON GET ROUTE');
|
||||
// await axios.get(process.env.DEV_URL + `/input`).then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Get('/:id')
|
||||
// async show(@Param() id: string) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON SHOW ROUTE');
|
||||
// await axios.get(process.env.DEV_URL + `/input/${id}`).then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Put(':id')
|
||||
// async update(
|
||||
// @Payload() updateInputDto: UpdateInputGrpcClientDto,
|
||||
// @Param() id: string,
|
||||
// ) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON UPDATE ROUTE');
|
||||
// await axios
|
||||
// .put(process.env.DEV_URL + `input/${id}`, updateInputDto)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Delete(':id')
|
||||
// async delete(@Param() id: string) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON DELETE ROUTE');
|
||||
|
||||
// await axios
|
||||
// .delete(process.env.DEV_URL + `/input/${id}`)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,8 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class InputsService {
|
||||
check() {
|
||||
return { message: 'Ok' };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// import {
|
||||
// Body,
|
||||
// Controller,
|
||||
// Delete,
|
||||
// Get,
|
||||
// Param,
|
||||
// Post,
|
||||
// Put,
|
||||
// Redirect,
|
||||
// } from '@nestjs/common';
|
||||
// import { Payload } from '@nestjs/microservices';
|
||||
// import axios from 'axios';
|
||||
// import { Console } from 'console';
|
||||
// // import { CreateInputGrpcClientDto } from './dto/create-input-grpc-client.dto';
|
||||
// // import { UpdateInputGrpcClientDto } from './dto/update-input-grpc-client.dto';
|
||||
|
||||
// @Controller('outputs')
|
||||
// export class OutputsController {
|
||||
// @Get('/test-connection')
|
||||
// async testConnection() {
|
||||
// console.log(
|
||||
// process.env.DEV_URL + `/test-connection`,
|
||||
// 'ON TEST CONNECTION ROUTE',
|
||||
// );
|
||||
// await axios
|
||||
// .get(process.env.DEV_URL + `/test-connection`)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Post()
|
||||
// async create(@Body() createInputDto: CreateInputGrpcClientDto) {
|
||||
// console.log(createInputDto);
|
||||
// console.log(process.env.DEV_URL + `/input`, 'ON CREATE ROUTE');
|
||||
|
||||
// await axios
|
||||
// .post(process.env.DEV_URL + '/input', createInputDto)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Get()
|
||||
// async list() {
|
||||
// console.log(process.env.DEV_URL + `/input`, 'ON GET ROUTE');
|
||||
// await axios.get(process.env.DEV_URL + `/input`).then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Get('/:id')
|
||||
// async show(@Param() id: string) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON SHOW ROUTE');
|
||||
// await axios.get(process.env.DEV_URL + `/input/${id}`).then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Put(':id')
|
||||
// async update(
|
||||
// @Payload() updateInputDto: UpdateInputGrpcClientDto,
|
||||
// @Param() id: string,
|
||||
// ) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON UPDATE ROUTE');
|
||||
// await axios
|
||||
// .put(process.env.DEV_URL + `input/${id}`, updateInputDto)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Delete(':id')
|
||||
// async delete(@Param() id: string) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON DELETE ROUTE');
|
||||
|
||||
// await axios
|
||||
// .delete(process.env.DEV_URL + `/input/${id}`)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,8 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class OutputsService {
|
||||
check() {
|
||||
return { message: 'Ok' };
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// import {
|
||||
// Body,
|
||||
// Controller,
|
||||
// Delete,
|
||||
// Get,
|
||||
// Param,
|
||||
// Post,
|
||||
// Put,
|
||||
// Redirect,
|
||||
// } from '@nestjs/common';
|
||||
// import { Payload } from '@nestjs/microservices';
|
||||
// import axios from 'axios';
|
||||
// import { Console } from 'console';
|
||||
// // import { CreateInputGrpcClientDto } from './dto/create-input-grpc-client.dto';
|
||||
// // import { UpdateInputGrpcClientDto } from './dto/update-input-grpc-client.dto';
|
||||
|
||||
// @Controller('pipelines')
|
||||
// export class PipelinesController {
|
||||
// @Get('/test-connection')
|
||||
// async testConnection() {
|
||||
// console.log(
|
||||
// process.env.DEV_URL + `/test-connection`,
|
||||
// 'ON TEST CONNECTION ROUTE',
|
||||
// );
|
||||
// await axios
|
||||
// .get(process.env.DEV_URL + `/test-connection`)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Post()
|
||||
// async create(@Body() createInputDto: CreateInputGrpcClientDto) {
|
||||
// console.log(createInputDto);
|
||||
// console.log(process.env.DEV_URL + `/input`, 'ON CREATE ROUTE');
|
||||
|
||||
// await axios
|
||||
// .post(process.env.DEV_URL + '/input', createInputDto)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Get()
|
||||
// async list() {
|
||||
// console.log(process.env.DEV_URL + `/input`, 'ON GET ROUTE');
|
||||
// await axios.get(process.env.DEV_URL + `/input`).then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Get('/:id')
|
||||
// async show(@Param() id: string) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON SHOW ROUTE');
|
||||
// await axios.get(process.env.DEV_URL + `/input/${id}`).then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Put(':id')
|
||||
// async update(
|
||||
// @Payload() updateInputDto: UpdateInputGrpcClientDto,
|
||||
// @Param() id: string,
|
||||
// ) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON UPDATE ROUTE');
|
||||
// await axios
|
||||
// .put(process.env.DEV_URL + `input/${id}`, updateInputDto)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Delete(':id')
|
||||
// async delete(@Param() id: string) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON DELETE ROUTE');
|
||||
|
||||
// await axios
|
||||
// .delete(process.env.DEV_URL + `/input/${id}`)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,8 @@
|
||||
// import { Injectable } from '@nestjs/common';
|
||||
|
||||
// @Injectable()
|
||||
// export class PipelinesService {
|
||||
// check() {
|
||||
// return { message: 'Ok' };
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,83 @@
|
||||
// import {
|
||||
// Body,
|
||||
// Controller,
|
||||
// Delete,
|
||||
// Get,
|
||||
// Param,
|
||||
// Post,
|
||||
// Put,
|
||||
// Redirect,
|
||||
// } from '@nestjs/common';
|
||||
// import { Payload } from '@nestjs/microservices';
|
||||
// import axios from 'axios';
|
||||
// import { Console } from 'console';
|
||||
// // import { CreateInputGrpcClientDto } from './dto/create-input-grpc-client.dto';
|
||||
// // import { UpdateInputGrpcClientDto } from './dto/update-input-grpc-client.dto';
|
||||
|
||||
// @Controller('transformations')
|
||||
// export class TransformationsController {
|
||||
// @Get('/test-connection')
|
||||
// async testConnection() {
|
||||
// console.log(
|
||||
// process.env.DEV_URL + `/test-connection`,
|
||||
// 'ON TEST CONNECTION ROUTE',
|
||||
// );
|
||||
// await axios
|
||||
// .get(process.env.DEV_URL + `/test-connection`)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Post()
|
||||
// async create(@Body() createInputDto: CreateInputGrpcClientDto) {
|
||||
// console.log(createInputDto);
|
||||
// console.log(process.env.DEV_URL + `/input`, 'ON CREATE ROUTE');
|
||||
|
||||
// await axios
|
||||
// .post(process.env.DEV_URL + '/input', createInputDto)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Get()
|
||||
// async list() {
|
||||
// console.log(process.env.DEV_URL + `/input`, 'ON GET ROUTE');
|
||||
// await axios.get(process.env.DEV_URL + `/input`).then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Get('/:id')
|
||||
// async show(@Param() id: string) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON SHOW ROUTE');
|
||||
// await axios.get(process.env.DEV_URL + `/input/${id}`).then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Put(':id')
|
||||
// async update(
|
||||
// @Payload() updateInputDto: UpdateInputGrpcClientDto,
|
||||
// @Param() id: string,
|
||||
// ) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON UPDATE ROUTE');
|
||||
// await axios
|
||||
// .put(process.env.DEV_URL + `input/${id}`, updateInputDto)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
|
||||
// @Delete(':id')
|
||||
// async delete(@Param() id: string) {
|
||||
// console.log(process.env.DEV_URL + `/input/${id}`, 'ON DELETE ROUTE');
|
||||
|
||||
// await axios
|
||||
// .delete(process.env.DEV_URL + `/input/${id}`)
|
||||
// .then((response) => {
|
||||
// return response;
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,8 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
@Injectable()
|
||||
export class TransformationsService {
|
||||
check() {
|
||||
return { message: 'Ok' };
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { join } from 'path';
|
||||
import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||
|
||||
export const GrpcClientConfiguration: ClientOptions = {
|
||||
transport: Transport.GRPC,
|
||||
options: {
|
||||
//url: `${process.env.USERS_SVC_URL}:${process.env.USERS_SVC_PORT}`,
|
||||
url: `127.0.0.1:50053`,
|
||||
package: 'output',
|
||||
protoPath: join(__dirname, '..', 'proto', 'output.proto'),
|
||||
loader: {
|
||||
enums: String,
|
||||
objects: true,
|
||||
arrays: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
export class CreateOutputDto {
|
||||
|
||||
name:string;
|
||||
plugin:string;
|
||||
values:string;
|
||||
operation:string;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
import { PartialType } from '@nestjs/mapped-types';
|
||||
import { CreateOutputDto } from './create-output.dto';
|
||||
|
||||
export class UpdateOutputDto extends PartialType(CreateOutputDto) {
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
export class Output {
|
||||
|
||||
id:string;
|
||||
name:string;
|
||||
plugin:string;
|
||||
values:string;
|
||||
operation:string;
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { OutputsController } from './outputs.controller';
|
||||
import { OutputsService } from './outputs.service';
|
||||
|
||||
describe('OutputsController', () => {
|
||||
let controller: OutputsController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [OutputsController],
|
||||
providers: [OutputsService],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<OutputsController>(OutputsController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,57 +0,0 @@
|
||||
import {
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
OnModuleInit,
|
||||
Param,
|
||||
Post,
|
||||
Put,
|
||||
} from '@nestjs/common';
|
||||
import {
|
||||
Client,
|
||||
ClientGrpc,
|
||||
MessagePattern,
|
||||
Payload,
|
||||
} from '@nestjs/microservices';
|
||||
import { OutputsService } from './outputs.service';
|
||||
import { CreateOutputDto } from './dto/create-output.dto';
|
||||
import { UpdateOutputDto } from './dto/update-output.dto';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
import { GrpcClientConfiguration } from './config/grpc-client';
|
||||
|
||||
@Controller('output')
|
||||
export class OutputsController implements OnModuleInit {
|
||||
@Client(GrpcClientConfiguration)
|
||||
private outputServiceClient: ClientGrpc;
|
||||
|
||||
private outputService: OutputsService;
|
||||
|
||||
onModuleInit() {
|
||||
this.outputService =
|
||||
this.outputServiceClient.getService<OutputsService>('OutputService');
|
||||
}
|
||||
@Post()
|
||||
create(@Payload() createOutputDto: CreateOutputDto) {
|
||||
return this.outputService.create(createOutputDto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
list() {
|
||||
return this.outputService.list();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
show(@Param() id: string) {
|
||||
return this.outputService.show(id);
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
update(@Param() id: string, @Payload() updateOutputDto: UpdateOutputDto) {
|
||||
return this.outputService.update(id, updateOutputDto);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
remove(@Param() id: string) {
|
||||
return this.outputService.remove(id);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { OutputsService } from './outputs.service';
|
||||
import { OutputsController } from './outputs.controller';
|
||||
|
||||
@Module({
|
||||
controllers: [OutputsController],
|
||||
providers: [OutputsService],
|
||||
})
|
||||
export class OutputsModule {}
|
||||
@@ -1,18 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { OutputsService } from './outputs.service';
|
||||
|
||||
describe('OutputsService', () => {
|
||||
let service: OutputsService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [OutputsService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<OutputsService>(OutputsService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,26 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { CreateOutputDto } from './dto/create-output.dto';
|
||||
import { UpdateOutputDto } from './dto/update-output.dto';
|
||||
|
||||
@Injectable()
|
||||
export class OutputsService {
|
||||
create(createOutputDto: CreateOutputDto) {
|
||||
return 'This action adds a new output';
|
||||
}
|
||||
|
||||
list() {
|
||||
return `This action returns all outputs`;
|
||||
}
|
||||
|
||||
show(id: string) {
|
||||
return `This action returns a #${id} output`;
|
||||
}
|
||||
|
||||
update(id: string, updateOutputDto: UpdateOutputDto) {
|
||||
return `This action updates a #${id} output`;
|
||||
}
|
||||
|
||||
remove(id: string) {
|
||||
return `This action removes a #${id} output`;
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package output;
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
|
||||
service OutputService{
|
||||
rpc Create(CreateOutputRequest) returns (Output) {}
|
||||
rpc Show(IdRequest) returns (Output) {}
|
||||
rpc List(Empty) returns (ListResponse){}
|
||||
rpc Update(UpdateOutputRequest) returns (Output){}
|
||||
rpc Remove(IdRequest) returns (Empty){}
|
||||
}
|
||||
|
||||
|
||||
message Empty {}
|
||||
|
||||
message IdRequest{
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message Output {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string plugin = 3;
|
||||
string values = 4;
|
||||
string operation = 5;
|
||||
}
|
||||
|
||||
message CreateOutputRequest {
|
||||
string name = 1;
|
||||
string plugin = 2;
|
||||
string values = 3;
|
||||
string operation = 4;
|
||||
}
|
||||
|
||||
message UpdateOutputRequest{
|
||||
string id = 1;
|
||||
string name = 3;
|
||||
string plugin = 4;
|
||||
string values = 5;
|
||||
string operation = 6;
|
||||
}
|
||||
|
||||
message ListResponse {
|
||||
repeated Output outputs = 1;
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { join } from 'path';
|
||||
import { ClientOptions, Transport } from '@nestjs/microservices';
|
||||
|
||||
export const GrpcClientConfiguration: ClientOptions = {
|
||||
transport: Transport.GRPC,
|
||||
options: {
|
||||
//url: `${process.env.USERS_SVC_URL}:${process.env.USERS_SVC_PORT}`,
|
||||
url: `127.0.0.1:50054`,
|
||||
package: 'pipeline',
|
||||
protoPath: join(__dirname, '..', 'proto', 'pipeline.proto'),
|
||||
loader: {
|
||||
enums: String,
|
||||
objects: true,
|
||||
arrays: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,12 +0,0 @@
|
||||
import { InputGrpcClient } from "src/inputs/entities/input-grcp-client.entity";
|
||||
import { Output } from "src/outputs/entities/output.entity";
|
||||
import { Transformation } from "src/transformations/entities/transformation.entity";
|
||||
|
||||
export class CreatePipelineDto {
|
||||
input:InputGrpcClient;
|
||||
output:Output;
|
||||
transformations:Transformation;
|
||||
tags:string[];
|
||||
name:string;
|
||||
description:string;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
import { PartialType } from '@nestjs/mapped-types';
|
||||
import { CreatePipelineDto } from './create-pipeline.dto';
|
||||
|
||||
export class UpdatePipelineDto extends PartialType(CreatePipelineDto) {
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { InputGrpcClient } from "src/inputs/entities/input-grcp-client.entity";
|
||||
import { Output } from "src/outputs/entities/output.entity";
|
||||
import { Transformation } from "src/transformations/entities/transformation.entity";
|
||||
|
||||
export class Pipeline {
|
||||
id:string;
|
||||
input:InputGrpcClient;
|
||||
output:Output;
|
||||
transformations:Transformation;
|
||||
tags:string[];
|
||||
name:string;
|
||||
description:string;
|
||||
status:string;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { PipelinesController } from './pipelines.controller';
|
||||
import { PipelinesService } from './pipelines.service';
|
||||
|
||||
describe('PipelinesController', () => {
|
||||
let controller: PipelinesController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [PipelinesController],
|
||||
providers: [PipelinesService],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<PipelinesController>(PipelinesController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,70 +0,0 @@
|
||||
import {
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
OnModuleInit,
|
||||
Param,
|
||||
Post,
|
||||
Put,
|
||||
} from '@nestjs/common';
|
||||
import {
|
||||
Client,
|
||||
ClientGrpc,
|
||||
MessagePattern,
|
||||
Payload,
|
||||
} from '@nestjs/microservices';
|
||||
import { PipelinesService } from './pipelines.service';
|
||||
import { CreatePipelineDto } from './dto/create-pipeline.dto';
|
||||
import { UpdatePipelineDto } from './dto/update-pipeline.dto';
|
||||
import { GrpcClientConfiguration } from './config/grpc-client';
|
||||
|
||||
@Controller('pipeline')
|
||||
|
||||
export class PipelinesController implements OnModuleInit {
|
||||
|
||||
@Client(GrpcClientConfiguration)
|
||||
private pipelineServiceClient: ClientGrpc;
|
||||
|
||||
private pipelineService: PipelinesService;
|
||||
|
||||
onModuleInit() {
|
||||
this.pipelineService =
|
||||
this.pipelineServiceClient.getService<PipelinesService>(
|
||||
'PipelineService',
|
||||
);
|
||||
}
|
||||
|
||||
@Post()
|
||||
create(@Payload() createPipelineDto: CreatePipelineDto) {
|
||||
return this.pipelineService.create(createPipelineDto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
list() {
|
||||
return this.pipelineService.list();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
show(@Param() id: string) {
|
||||
return this.pipelineService.show(id);
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
update(@Param() id: string, @Payload() updatePipelineDto: UpdatePipelineDto) {
|
||||
return this.pipelineService.update(id, updatePipelineDto);
|
||||
}
|
||||
|
||||
@Delete()
|
||||
remove(@Param() id: string) {
|
||||
return this.pipelineService.remove(id);
|
||||
}
|
||||
|
||||
@Post()
|
||||
getPipelineLogsMessages(@Param() id: string, @Payload() details: string) {
|
||||
return this.pipelineService.getPipelineLogsMessages(id, details);
|
||||
}
|
||||
|
||||
getPipelineStatus(id: string) {
|
||||
return this.pipelineService.getPipelineStatus(id);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { PipelinesService } from './pipelines.service';
|
||||
import { PipelinesController } from './pipelines.controller';
|
||||
|
||||
@Module({
|
||||
controllers: [PipelinesController],
|
||||
providers: [PipelinesService],
|
||||
})
|
||||
export class PipelinesModule {}
|
||||
@@ -1,18 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { PipelinesService } from './pipelines.service';
|
||||
|
||||
describe('PipelinesService', () => {
|
||||
let service: PipelinesService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [PipelinesService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<PipelinesService>(PipelinesService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,34 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { CreatePipelineDto } from './dto/create-pipeline.dto';
|
||||
import { UpdatePipelineDto } from './dto/update-pipeline.dto';
|
||||
|
||||
@Injectable()
|
||||
export class PipelinesService {
|
||||
create(createPipelineDto: CreatePipelineDto) {
|
||||
return 'This action adds a new pipeline';
|
||||
}
|
||||
|
||||
list() {
|
||||
return `This action returns all pipelines`;
|
||||
}
|
||||
|
||||
show(id: string) {
|
||||
return `This action returns a #${id} pipeline`;
|
||||
}
|
||||
|
||||
update(id: string, updatePipelineDto: UpdatePipelineDto) {
|
||||
return `This action updates a #${id} pipeline`;
|
||||
}
|
||||
|
||||
remove(id: string) {
|
||||
return `This action removes a #${id} pipeline`;
|
||||
}
|
||||
|
||||
getPipelineLogsMessages(id: string, details: string) {
|
||||
return `This action perfoms a getLogMessages on #${id} pipeline`;
|
||||
}
|
||||
|
||||
getPipelineStatus(id: string) {
|
||||
return `This action performs a getStatus on #${id} pipeline`;
|
||||
}
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package pipeline;
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
service PipelineService{
|
||||
rpc Create(CreatePipelineRequest) returns (Pipeline) {}
|
||||
rpc Show(IdRequest) returns (Pipeline) {}
|
||||
rpc List(Empty) returns (ListResponse){}
|
||||
rpc Update(UpdatePipelineRequest) returns (Pipeline){}
|
||||
rpc Remove(IdRequest) returns (Empty){}
|
||||
rpc getPipelineLogsMessages(getPipelineLogsMessagesRequest) returns (getPipelineLogsMessagesResponse){}
|
||||
rpc getPipelineStatus(IdRequest) returns (getPipelineStatusResponse){}
|
||||
}
|
||||
|
||||
|
||||
message Empty {}
|
||||
|
||||
message IdRequest{
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message Transformation {
|
||||
string id = 1;
|
||||
string inputSource = 2;
|
||||
string table = 3;
|
||||
string type = 4;
|
||||
string params = 5;
|
||||
}
|
||||
|
||||
message Input {
|
||||
string id = 1;
|
||||
string cronFormated = 2;
|
||||
string name = 3;
|
||||
string plugin = 4;
|
||||
string values = 5;
|
||||
string operation = 6;
|
||||
}
|
||||
|
||||
message Output {
|
||||
string id = 1;
|
||||
string name = 2;
|
||||
string plugin = 3;
|
||||
string values = 4;
|
||||
string operation = 5;
|
||||
}
|
||||
|
||||
message Pipeline {
|
||||
string id = 1;
|
||||
Input input = 2;
|
||||
Output output = 3;
|
||||
Transformation transformations = 4;
|
||||
repeated string tags = 5;
|
||||
string name = 6;
|
||||
string description = 7;
|
||||
string status = 8;
|
||||
}
|
||||
|
||||
message CreatePipelineRequest {
|
||||
Input input = 1;
|
||||
Output output = 2;
|
||||
Transformation transformations = 3;
|
||||
repeated string tags = 4;
|
||||
string name = 5;
|
||||
string description = 6;
|
||||
}
|
||||
|
||||
message UpdatePipelineRequest{
|
||||
string id = 1;
|
||||
repeated string tags = 2;
|
||||
string name = 3;
|
||||
string description = 4;
|
||||
string status = 5;
|
||||
}
|
||||
|
||||
message ListResponse {
|
||||
repeated Pipeline pipelines = 1;
|
||||
}
|
||||
|
||||
message getPipelineLogsMessagesRequest{
|
||||
string id = 1;
|
||||
string details = 2;
|
||||
}
|
||||
|
||||
message getPipelineLogsMessagesResponseItem{
|
||||
string date = 1;
|
||||
string log = 2;
|
||||
}
|
||||
|
||||
message getPipelineLogsMessagesResponse{
|
||||
repeated getPipelineLogsMessagesResponseItem pipelineLogs = 1;
|
||||
}
|
||||
|
||||
message getPipelineStatusResponse{
|
||||
string status = 1;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
export class CreateRestEnrichmentDto {
|
||||
|
||||
type:string;
|
||||
|
||||
columns
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
import { PartialType } from '@nestjs/swagger';
|
||||
import { CreateRestEnrichmentDto } from './create-rest-enrichment.dto';
|
||||
|
||||
export class UpdateRestEnrichmentDto extends PartialType(CreateRestEnrichmentDto) {}
|
||||
@@ -1,7 +0,0 @@
|
||||
export class RestEnrichment {
|
||||
id:string;
|
||||
|
||||
type:string;
|
||||
|
||||
columns:string[]
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { RestEnrichmentsController } from './rest-enrichments.controller';
|
||||
import { RestEnrichmentsService } from './rest-enrichments.service';
|
||||
|
||||
describe('RestEnrichmentsController', () => {
|
||||
let controller: RestEnrichmentsController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [RestEnrichmentsController],
|
||||
providers: [RestEnrichmentsService],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<RestEnrichmentsController>(RestEnrichmentsController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,92 +0,0 @@
|
||||
import { Controller, Get, Post, Body, Patch, Param, Delete, Put, Headers} from '@nestjs/common';
|
||||
import { RestEnrichmentsService } from './rest-enrichments.service';
|
||||
import { CreateRestEnrichmentDto } from './dto/create-rest-enrichment.dto';
|
||||
import { UpdateRestEnrichmentDto } from './dto/update-rest-enrichment.dto';
|
||||
import axios from 'axios';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('Enrichments')
|
||||
@Controller('enrichment')
|
||||
export class RestEnrichmentsController {
|
||||
constructor(private readonly restEnrichmentsService: RestEnrichmentsService) {}
|
||||
|
||||
@Post()
|
||||
async create(@Body() body: CreateRestEnrichmentDto,@Headers() headers) {
|
||||
|
||||
const connectionResponse = await axios.post(
|
||||
`${process.env.DEV_URL}/enrichment`,
|
||||
body,
|
||||
{
|
||||
headers:{
|
||||
"Authorization":headers.authorization,
|
||||
"Content-Type":"application/json"
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return connectionResponse.data
|
||||
}
|
||||
|
||||
@Get()
|
||||
async list(@Headers() headers) {
|
||||
|
||||
const connectionResponse = await axios.get(
|
||||
`${process.env.DEV_URL}/enrichment`,
|
||||
{
|
||||
headers:{
|
||||
"Authorization":headers.authorization
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return connectionResponse.data
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
async show(@Param('id') id: string,@Headers() headers) {
|
||||
|
||||
const connectionResponse = await axios.get(
|
||||
`${process.env.DEV_URL}/enrichment/${id}`,
|
||||
{
|
||||
headers:{
|
||||
"Authorization":headers.authorization
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return connectionResponse.data
|
||||
}
|
||||
|
||||
@Put(':id')
|
||||
async update(@Param('id') id: string,@Headers() headers, @Body() body: UpdateRestEnrichmentDto) {
|
||||
|
||||
const connectionResponse = await axios.put(
|
||||
`${process.env.DEV_URL}/enrichment/${id}`,
|
||||
body,
|
||||
{
|
||||
headers:{
|
||||
"Authorization":headers.authorization,
|
||||
"Content-Type":"application/json"
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return connectionResponse.data
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
async remove(@Param('id') id: string,@Headers() headers) {
|
||||
|
||||
const connectionResponse = await axios.delete(
|
||||
`${process.env.DEV_URL}/enrichment/${id}`,
|
||||
{
|
||||
headers:{
|
||||
"Authorization":headers.authorization,
|
||||
"Content-Type":"application/json"
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return connectionResponse.data
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { RestEnrichmentsService } from './rest-enrichments.service';
|
||||
import { RestEnrichmentsController } from './rest-enrichments.controller';
|
||||
|
||||
@Module({
|
||||
controllers: [RestEnrichmentsController],
|
||||
providers: [RestEnrichmentsService]
|
||||
})
|
||||
export class RestEnrichmentsModule {}
|
||||
@@ -1,18 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { RestEnrichmentsService } from './rest-enrichments.service';
|
||||
|
||||
describe('RestEnrichmentsService', () => {
|
||||
let service: RestEnrichmentsService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [RestEnrichmentsService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<RestEnrichmentsService>(RestEnrichmentsService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,26 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { CreateRestEnrichmentDto } from './dto/create-rest-enrichment.dto';
|
||||
import { UpdateRestEnrichmentDto } from './dto/update-rest-enrichment.dto';
|
||||
|
||||
@Injectable()
|
||||
export class RestEnrichmentsService {
|
||||
create(createRestEnrichmentDto: CreateRestEnrichmentDto) {
|
||||
return 'This action adds a new restEnrichment';
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return `This action returns all restEnrichments`;
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return `This action returns a #${id} restEnrichment`;
|
||||
}
|
||||
|
||||
update(id: number, updateRestEnrichmentDto: UpdateRestEnrichmentDto) {
|
||||
return `This action updates a #${id} restEnrichment`;
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return `This action removes a #${id} restEnrichment`;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export class CreateRestFactoryDto {}
|
||||
@@ -1,4 +0,0 @@
|
||||
import { PartialType } from '@nestjs/swagger';
|
||||
import { CreateRestFactoryDto } from './create-rest-factory.dto';
|
||||
|
||||
export class UpdateRestFactoryDto extends PartialType(CreateRestFactoryDto) {}
|
||||
@@ -1 +0,0 @@
|
||||
export class RestFactory {}
|
||||
@@ -1,20 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { RestFactoryController } from './rest-factory.controller';
|
||||
import { RestFactoryService } from './rest-factory.service';
|
||||
|
||||
describe('RestFactoryController', () => {
|
||||
let controller: RestFactoryController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [RestFactoryController],
|
||||
providers: [RestFactoryService],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<RestFactoryController>(RestFactoryController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,60 +0,0 @@
|
||||
import { Controller, Get, Param, Headers } from '@nestjs/common';
|
||||
import { RestFactoryService } from './rest-factory.service';
|
||||
import axios from 'axios';
|
||||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ApiTags('Dag Factory')
|
||||
@ApiBearerAuth()
|
||||
@Controller('factory')
|
||||
export class RestFactoryController {
|
||||
constructor(private readonly restFactoryService: RestFactoryService) {}
|
||||
|
||||
|
||||
@Get('/start')
|
||||
async startDagFactory(@Headers() headers) {
|
||||
|
||||
const connectionResponse = await axios.get(
|
||||
`${process.env.DEV_URL}/factory/start`,
|
||||
{
|
||||
headers:{
|
||||
"Authorization":headers.authorization
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return connectionResponse.data
|
||||
}
|
||||
|
||||
|
||||
@Get('/pipeline_params')
|
||||
async sendJSONSettingsToDagFactory(@Headers() headers) {
|
||||
|
||||
const connectionResponse = await axios.get(
|
||||
`${process.env.DEV_URL}/factory/pipeline_params`,
|
||||
{
|
||||
headers:{
|
||||
"Authorization":headers.authorization
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return connectionResponse.data
|
||||
}
|
||||
|
||||
@Get('/start/:pipelineId')
|
||||
async startDag(@Param('pipelineId') pipelineId:string,@Headers() headers) {
|
||||
|
||||
const connectionResponse = await axios.get(
|
||||
`${process.env.DEV_URL}/factory/start/${pipelineId}`,
|
||||
{
|
||||
headers:{
|
||||
"Authorization":headers.authorization
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
return connectionResponse.data
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { RestFactoryService } from './rest-factory.service';
|
||||
import { RestFactoryController } from './rest-factory.controller';
|
||||
|
||||
@Module({
|
||||
controllers: [RestFactoryController],
|
||||
providers: [RestFactoryService]
|
||||
})
|
||||
export class RestFactoryModule {}
|
||||
@@ -1,18 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { RestFactoryService } from './rest-factory.service';
|
||||
|
||||
describe('RestFactoryService', () => {
|
||||
let service: RestFactoryService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [RestFactoryService],
|
||||
}).compile();
|
||||
|
||||
service = module.get<RestFactoryService>(RestFactoryService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -1,26 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { CreateRestFactoryDto } from './dto/create-rest-factory.dto';
|
||||
import { UpdateRestFactoryDto } from './dto/update-rest-factory.dto';
|
||||
|
||||
@Injectable()
|
||||
export class RestFactoryService {
|
||||
create(createRestFactoryDto: CreateRestFactoryDto) {
|
||||
return 'This action adds a new restFactory';
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return `This action returns all restFactory`;
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return `This action returns a #${id} restFactory`;
|
||||
}
|
||||
|
||||
update(id: number, updateRestFactoryDto: UpdateRestFactoryDto) {
|
||||
return `This action updates a #${id} restFactory`;
|
||||
}
|
||||
|
||||
remove(id: number) {
|
||||
return `This action removes a #${id} restFactory`;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
|
||||
|
||||
export class HTTPInputValues{
|
||||
|
||||
@ApiProperty({
|
||||
description:"Choosen url",
|
||||
example:"http://testroute/dadosfera/inputs/values"
|
||||
})
|
||||
urls:string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Schedule name",
|
||||
example:"Test_Schedule"
|
||||
})
|
||||
schedule:string
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
|
||||
|
||||
export class JDBCInputvalues{
|
||||
|
||||
@ApiProperty({
|
||||
description:"JDBC user",
|
||||
example:"airflow"
|
||||
})
|
||||
jdbc_user: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"JDBC password",
|
||||
example:"password123"
|
||||
})
|
||||
jdbc_password: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Database",
|
||||
example:"airflow"
|
||||
})
|
||||
database: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Connection endpoint",
|
||||
example:"dadosfera-postgres-db.test123.us-east"
|
||||
})
|
||||
endpoint: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Schema name",
|
||||
example:"cadastros"
|
||||
})
|
||||
schema?:string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Tables names",
|
||||
example:["pessoas", "clients"]
|
||||
})
|
||||
table: string[];
|
||||
|
||||
@ApiProperty({
|
||||
description:"Port",
|
||||
example:"5432"
|
||||
})
|
||||
port: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Engine name",
|
||||
example:"postgres"
|
||||
})
|
||||
engine: string;
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { CronDTO } from "./cron.dto";
|
||||
import { HTTPInputValues } from "./HTTPInputValues.dto";
|
||||
import { JDBCInputvalues } from "./JDBCInputValues.dto";
|
||||
import { S3InputValues } from "./s3InputValues.dto";
|
||||
import { SalesforceInputValuesDTO } from "./salesforceInputValues.dto";
|
||||
|
||||
export class CreateRestInputDto {
|
||||
|
||||
@ApiProperty({
|
||||
description:"Input CRON",
|
||||
example:{
|
||||
hours: ["3", "7"],
|
||||
hour_interval: true,
|
||||
hour_resourse: true,
|
||||
hour_resourse_value: 3,
|
||||
month_day: ["3"],
|
||||
month_day_interval: true,
|
||||
month_day_resourse: false,
|
||||
month_day_resourse_value: null,
|
||||
month: ["3"],
|
||||
month_interval: false,
|
||||
month_resourse: false,
|
||||
month_resourse_value: null,
|
||||
week_days: [],
|
||||
week_days_interval: false,
|
||||
week_days_resourse: false,
|
||||
week_days_resourse_value: null
|
||||
}
|
||||
})
|
||||
cron:CronDTO;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Name of the input",
|
||||
example:"Test_Input"
|
||||
})
|
||||
name:string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Plugin",
|
||||
example:"s3"
|
||||
})
|
||||
plugin:string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Values for choosen input",
|
||||
example:{
|
||||
jdbc_user: "user123",
|
||||
jdbc_password: "password123",
|
||||
database: "default_database",
|
||||
endpoint: "dadosfera-postgres-db.test123.us-east-1.rds.amazonaws.com",
|
||||
table: "test_table",
|
||||
port: "5432",
|
||||
engine: "postgresql"
|
||||
}
|
||||
})
|
||||
values: SalesforceInputValuesDTO|HTTPInputValues|S3InputValues|JDBCInputvalues;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Operation name",
|
||||
example:"input"
|
||||
})
|
||||
operation:string;
|
||||
}
|
||||
@@ -1,102 +0,0 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
|
||||
|
||||
export class CronDTO{
|
||||
|
||||
@ApiProperty({
|
||||
description:"Hours to the cron",
|
||||
example:["3","7"]
|
||||
})
|
||||
hours: string[];
|
||||
|
||||
@ApiProperty({
|
||||
description:"Boolean for hour interval",
|
||||
example:true
|
||||
})
|
||||
hour_interval: boolean;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Boolean for hour resourse",
|
||||
example:true
|
||||
})
|
||||
hour_resourse: boolean;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Value for hour resourse",
|
||||
example:3
|
||||
})
|
||||
hour_resourse_value: number;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Month day to the cron",
|
||||
example:["3"]
|
||||
})
|
||||
month_day: string[];
|
||||
|
||||
@ApiProperty({
|
||||
description:"Boolean for month day interval",
|
||||
example:true
|
||||
})
|
||||
month_day_interval: boolean;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Boolean for month day resourse",
|
||||
example:false
|
||||
})
|
||||
month_day_resourse: boolean;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Value for month day resourse",
|
||||
example:null
|
||||
})
|
||||
month_day_resourse_value:number|null;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Month to the cron",
|
||||
example:["3"]
|
||||
})
|
||||
month: string[];
|
||||
|
||||
@ApiProperty({
|
||||
description:"Boolean from month interval",
|
||||
example:false
|
||||
})
|
||||
month_interval: boolean;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Boolean from month resourse",
|
||||
example:false
|
||||
})
|
||||
month_resourse: boolean;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Value to month resourse",
|
||||
example:null
|
||||
})
|
||||
month_resourse_value:number|null;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Week days to the cron",
|
||||
example:[]
|
||||
})
|
||||
week_days: string[];
|
||||
|
||||
@ApiProperty({
|
||||
description:"Boolean for the week days",
|
||||
example:false
|
||||
})
|
||||
week_days_interval: boolean;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Boolean for week day resourse",
|
||||
example:false
|
||||
})
|
||||
week_days_resourse: boolean;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Hours to the cron",
|
||||
example:null
|
||||
})
|
||||
week_days_resourse_value:number|null
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
|
||||
|
||||
export class S3InputValues{
|
||||
|
||||
@ApiProperty({
|
||||
description:"file to extract path",
|
||||
example:"s3_connector/testfile.csv"
|
||||
})
|
||||
file_to_extract: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"target bucket path",
|
||||
example:"dadosfera-test"
|
||||
})
|
||||
target_bucket?: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"client bucket path",
|
||||
example:"dadosfera-test"
|
||||
})
|
||||
client_bucket: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Format to the file",
|
||||
example:"csv"
|
||||
})
|
||||
format_file: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Clients AWS Access Key Id",
|
||||
example:"AKIBN5B19D3NGZI"
|
||||
})
|
||||
client_aws_access_key_id: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Clients AWS Secret Access Key Id",
|
||||
example:"ct5R1EjrVC78bvaJ636gG90O5NqOrOUoq4Ri"
|
||||
})
|
||||
client_aws_secret_access_key : string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"file params format",
|
||||
example:{sep: "," , header: "true"}
|
||||
})
|
||||
format_file_params?: {
|
||||
sep: string,
|
||||
header: string
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
|
||||
|
||||
export class SalesforceInputValuesDTO{
|
||||
|
||||
@ApiProperty({
|
||||
description:"Salesforce username",
|
||||
example:"dadosfera@devs.com"
|
||||
})
|
||||
username_salesforce: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Salesforce password",
|
||||
example:"Salesforce@test123"
|
||||
})password_salesforce: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Salesforce Security Token",
|
||||
example:"A67Tdg7qHUvhZDOFjWwtPMjmQ"
|
||||
})security_token_salesforce: string;
|
||||
|
||||
@ApiProperty({
|
||||
description:"Salesforce Query",
|
||||
example:"SELECT * FROM Users"
|
||||
})query_salesforce: string;
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { HTTPInputValues } from "./HTTPInputValues.dto";
|
||||
import { JDBCInputvalues } from "./JDBCInputValues.dto";
|
||||
import { S3InputValues } from "./s3InputValues.dto";
|
||||
import { SalesforceInputValuesDTO } from "./salesforceInputValues.dto";
|
||||
|
||||
|
||||
export class testConnectionDTO{
|
||||
|
||||
@ApiProperty({
|
||||
description:"Input Plugin Name",
|
||||
example:"mysql"
|
||||
})
|
||||
plugin:string;
|
||||
|
||||
|
||||
@ApiProperty({
|
||||
description:"Plugin name",
|
||||
example:{
|
||||
plugin: "mysql",
|
||||
values: {
|
||||
jdbc_user: "test",
|
||||
jdbc_password: "test1234",
|
||||
database: "users",
|
||||
endpoint: "dadosfera.test123.us-east-1.rds.amazonaws.com",
|
||||
schema: "user",
|
||||
port: "5432",
|
||||
engine: "mysql"
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
values:HTTPInputValues|SalesforceInputValuesDTO|S3InputValues|JDBCInputvalues
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user