Adding pre-commit

This commit is contained in:
alexsanderp
2022-02-04 10:03:55 -03:00
parent 7de6d5c14d
commit b8492c6840
46 changed files with 140 additions and 138 deletions
-1
View File
@@ -1 +0,0 @@
TEST=test
+2 -1
View File
@@ -34,4 +34,5 @@ lerna-debug.log*
!.vscode/launch.json
!.vscode/extensions.json
.env
# Ignore .env files
*.env
+6
View File
@@ -0,0 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
+1 -1
View File
@@ -1,4 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
}
+1 -1
View File
@@ -9,4 +9,4 @@ COPY . /app/
COPY --from=packages /packages/node_modules /app/node_modules
RUN npm run build
EXPOSE 3333
ENTRYPOINT npm run start
ENTRYPOINT npm run start
+6 -6
View File
@@ -21,12 +21,12 @@ import { RestEnrichmentsController } from './rest/rest-enrichments/rest-enrichme
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,
imports: [
RestInputsModule, RestOutputsModule, RestEnrichmentsModule, RestTransformationsModule, RestPipelinesModule, RestUserModule, RestFactoryModule, HealthModule,
// InputGrpcClientModule,
//OutputsModule,
//EnrichmentModule,
//TransformationsModule,
//EnrichmentModule,
//TransformationsModule,
//PipelinesModule
],
controllers: [],
@@ -39,6 +39,6 @@ export class AppModule implements NestModule{
.apply(LoggerMiddleware)
.forRoutes(RestInputsController,RestOutputsController,RestTransformationsController,RestPipelinesController,RestEnrichmentsController,RestFactoryController)
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
export class CreateEnrichmentDto {
type:string;
columns:string[]
+1 -1
View File
@@ -9,7 +9,7 @@ import { GrpcClientConfiguration } from './config/grpc-client';
@ApiTags('enrichments')
@Controller('enrichment')
export class EnrichmentController implements OnModuleInit {
@Client(GrpcClientConfiguration)
-1
View File
@@ -41,4 +41,3 @@ message CreateEnrichmentRequest {
message ListResponse {
repeated Enrichment enrichments = 2;
}
@@ -2,12 +2,12 @@
export class CreateInputGrpcClientDto {
cron:string;
name:string;
plugin:string;
values:string;
operation:string;
}
@@ -3,4 +3,3 @@ export class TestConnectionDTO{
values:string;
plugin:string;
}
@@ -1,14 +1,14 @@
export class InputGrpcClient {
id:string;
cron:string;
name:string;
plugin:string;
values:string;
operation:string;
}
+1 -1
View File
@@ -5,7 +5,7 @@ import { InputGrpcClientController } from './input-grpc-client.controller';
@Module({
controllers: [
InputGrpcClientController,
InputGrpcClientController,
// InputRestClientController
],
providers: [InputGrpcClientService],
+6 -6
View File
@@ -8,7 +8,7 @@ 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")
@@ -16,17 +16,17 @@ export class InputRestClientController {
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")
@@ -43,7 +43,7 @@ export class InputRestClientController {
return response
})
}
@Put(':id')
async update(
@@ -60,7 +60,7 @@ export class InputRestClientController {
@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
})
+2 -2
View File
@@ -58,8 +58,8 @@ message TestConnectionRequest{
}
message TestConnectionResponse{
// nao sei como vai ser a resposta
bool respose = 1;
}
}
+2 -2
View File
@@ -3,7 +3,7 @@ import axios from 'axios';
import { NestMiddleware } from '@nestjs/common';
export class LoggerMiddleware implements NestMiddleware{
use = async (
request: Request,
@@ -27,4 +27,4 @@ export class LoggerMiddleware implements NestMiddleware{
}
};
}
}
-1
View File
@@ -5,4 +5,3 @@ export class CreateOutputDto {
values:string;
operation:string;
}
+1 -1
View File
@@ -2,5 +2,5 @@ import { PartialType } from '@nestjs/mapped-types';
import { CreateOutputDto } from './create-output.dto';
export class UpdateOutputDto extends PartialType(CreateOutputDto) {
}
+1 -1
View File
@@ -7,7 +7,7 @@ import { GrpcClientConfiguration } from './config/grpc-client';
@Controller('pipeline')
export class PipelinesController implements OnModuleInit{
@Client(GrpcClientConfiguration)
private pipelineServiceClient: ClientGrpc;
+4 -4
View File
@@ -37,7 +37,7 @@ message Input {
string values = 5;
string operation = 6;
}
message Output {
string id = 1;
string name = 2;
@@ -80,12 +80,12 @@ message ListResponse {
message getPipelineLogsMessagesRequest{
string id = 1;
string details = 2;
string details = 2;
}
message getPipelineLogsMessagesResponseItem{
string date = 1;
string log = 2;
string log = 2;
}
message getPipelineLogsMessagesResponse{
@@ -94,4 +94,4 @@ message getPipelineLogsMessagesResponse{
message getPipelineStatusResponse{
string status = 1;
}
}
@@ -1,5 +1,5 @@
export class CreateRestEnrichmentDto {
type:string;
columns
@@ -59,7 +59,7 @@ export class RestEnrichmentsController {
@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,
@@ -2,16 +2,16 @@ 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
}
}
@@ -2,52 +2,52 @@ 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;
}
}
@@ -29,19 +29,19 @@ export class CreateRestInputDto {
}
})
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:{
@@ -55,7 +55,7 @@ export class CreateRestInputDto {
}
})
values: SalesforceInputValuesDTO|HTTPInputValues|S3InputValues|JDBCInputvalues;
@ApiProperty({
description:"Operation name",
example:"input"
+15 -15
View File
@@ -14,89 +14,89 @@ export class CronDTO{
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
}
}
@@ -14,37 +14,37 @@ export class S3InputValues{
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,
sep: string,
header: string
}
}
}
@@ -8,20 +8,20 @@ export class SalesforceInputValuesDTO{
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;
}
}
@@ -18,7 +18,7 @@ export class testConnectionDTO{
description:"Plugin name",
example:{
plugin: "mysql",
values: {
values: {
jdbc_user: "test",
jdbc_password: "test1234",
database: "users",
@@ -29,6 +29,6 @@ export class testConnectionDTO{
}
}
})
values:HTTPInputValues|SalesforceInputValuesDTO|S3InputValues|JDBCInputvalues
}
}
@@ -1,14 +1,14 @@
export class RestInput {
id:string;
cron:string;
name:string;
plugin:string;
values:string;
operation:string;
}
@@ -28,7 +28,7 @@ export class RestInputsController {
}
)
return connectionResponse.data
}
@@ -46,7 +46,7 @@ export class RestInputsController {
}
)
return connectionResponse.data
}
@@ -62,7 +62,7 @@ export class RestInputsController {
}
)
return connectionResponse.data
}
@@ -78,7 +78,7 @@ export class RestInputsController {
}
)
return connectionResponse.data
}
@@ -100,7 +100,7 @@ export class RestInputsController {
}
)
return connectionResponse.data
}
@@ -116,7 +116,7 @@ export class RestInputsController {
}
)
return connectionResponse.data
}
@@ -7,13 +7,13 @@ export class CreateRestOutputDto {
example:"Test Output"
})
name:string;
@ApiProperty({
description:"Plugin name",
example:"Test Plugin"
})
plugin:string;
@ApiProperty({
description:"Plugin values",
example:{
@@ -23,7 +23,7 @@ export class CreateRestOutputDto {
values:{
prefix:string
};
@ApiProperty({
description:"Operation name",
example:"output"
@@ -76,7 +76,7 @@ export class RestOutputsController {
@Delete(':id')
async remove(@Param('id') id: string,@Headers() headers) {
const connectionResponse = await axios.delete(
`${process.env.DEV_URL}/output/${id}`,
{
@@ -25,7 +25,7 @@ export class RestTransformationsController {
}
)
return connectionResponse.data
}
@@ -41,7 +41,7 @@ export class RestTransformationsController {
}
)
return connectionResponse.data
}
@@ -57,7 +57,7 @@ export class RestTransformationsController {
}
)
return connectionResponse.data
}
@@ -75,7 +75,7 @@ export class RestTransformationsController {
}
)
return connectionResponse.data
}
@@ -91,7 +91,7 @@ export class RestTransformationsController {
}
)
return connectionResponse.data
}
}
@@ -1,37 +1,37 @@
import { ApiProperty } from "@nestjs/swagger";
export class CreateRestUserDto {
@ApiProperty({
description:"User Email",
example:"dev@dadosfera.ai"
})
email: string;
email: string;
@ApiProperty({
description:"User Password",
example:"dadospassword123"
})
password: string;
@ApiProperty({
description:"User Username",
example:"dev_fera"
})
username: string;
@ApiProperty({
description:"User name",
example:"Fulano da Silva"
})
name: string;
@ApiProperty({
description:"Customer id",
example:"dadosfera"
})
customer_id: string;
@ApiProperty({
description:"User rules",
example:"['admin']"
+1 -1
View File
@@ -7,4 +7,4 @@ export class ResendCodeDTO{
example:"dev_fera"
})
username:string
}
}
+1 -1
View File
@@ -15,4 +15,4 @@ export class UserAuthDTO{
example:"dadospassword123"
})
password:string;
}
}
@@ -8,10 +8,10 @@ export class UserConfirmationDTO{
})
username:string;
@ApiProperty({
description:"Received Confirmation Code",
example:"315246"
})
confirmationCode:string;
}
}
+3 -3
View File
@@ -33,7 +33,7 @@ export class RestUserController {
@Post('/auth')
async auth(@Body() body: UserAuthDTO) {
const connectionResponse = await axios.post(
`${process.env.DEV_URL}/user/auth`,
body,
@@ -50,7 +50,7 @@ export class RestUserController {
@Post('/confirm')
async confirm(@Body() body: UserConfirmationDTO) {
const connectionResponse = await axios.post(
`${process.env.DEV_URL}/user/confirm`,
body,
@@ -81,5 +81,5 @@ export class RestUserController {
return connectionResponse.data
}
}
@@ -2,10 +2,10 @@
export class CreateTransformationDto {
inputSource:string;
table:string;
type:string;
params:string;
}
@@ -1,14 +1,14 @@
export class Transformation {
id:string;
inputSource:string;
table:string;
type:string;
params:string;
}
@@ -47,4 +47,3 @@ message CreateTransformationRequest {
message ListResponse {
repeated Transformation transformations = 2;
}
@@ -8,7 +8,7 @@ import { GrpcClientConfiguration } from './config/grpc-client';
@Controller('transformation')
export class TransformationsController implements OnModuleInit {
@Client(GrpcClientConfiguration)
private transformationServiceClient: ClientGrpc;
@@ -21,7 +21,7 @@ export class TransformationsController implements OnModuleInit {
@Post()
create(@Payload() createTransformationDto: CreateTransformationDto[]) {
return createTransformationDto.map( transf => this.transformationService.create(transf))
}
+1 -1
View File
@@ -34,4 +34,4 @@ message UserResponse {
message ShowResponse {
repeated UserResponse users = 1;
}
}
+4 -4
View File
@@ -5,16 +5,16 @@ export class AuthenticateController{
private username:string;
private password:string;
constructor(){
this.username = process.env.AUTH_USERNAME
this.password = process.env.AUTH_PASSWORD
}
async authenticate():Promise<string>{
const response = await axios.post(process.env.AUTH_ROUTE,
{
username:this.username,
@@ -26,4 +26,4 @@ export class AuthenticateController{
}
}
}
+1 -1
View File
File diff suppressed because one or more lines are too long