mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-30 21:20:06 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0103f100f5 | ||
|
|
66b6be43b7 | ||
|
|
a8f94a2d53 | ||
|
|
aadb3fcdee | ||
|
|
a26e88d2b6 | ||
|
|
fc7a9c7909 | ||
|
|
932616a578 | ||
|
|
4ffd0916c3 |
@@ -113,10 +113,12 @@ jobs:
|
|||||||
ENV: ${{ needs.extract_environment.outputs.environment }}
|
ENV: ${{ needs.extract_environment.outputs.environment }}
|
||||||
IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }}
|
IMAGE_TAG: ${{ needs.semantic_release.outputs.new_release_version }}
|
||||||
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
|
ACCOUNT_ID: ${{ steps.aws.outputs.aws-account-id }}
|
||||||
|
NODE_EXPORTER_URL: ${{needs.extract_environment.outputs.environment == 'prd' && '611330257153.dkr.ecr.us-east-1.amazonaws.com\/monitoring\/node_exporter:latest' || '468720548566.dkr.ecr.us-east-1.amazonaws.com\/monitoring\/node_exporter:latest'}}
|
||||||
run: |
|
run: |
|
||||||
sed -i -e "s/\${ENV}/$ENV/g" docker-compose.yml
|
sed -i -e "s/\${ENV}/$ENV/g" docker-compose.yml
|
||||||
sed -i -e "s/\${IMAGE_TAG}/$IMAGE_TAG/g" docker-compose.yml
|
sed -i -e "s/\${IMAGE_TAG}/$IMAGE_TAG/g" docker-compose.yml
|
||||||
sed -i -e "s/\${ACCOUNT_ID}/$ACCOUNT_ID/g" docker-compose.yml
|
sed -i -e "s/\${ACCOUNT_ID}/$ACCOUNT_ID/g" docker-compose.yml
|
||||||
|
sed -i -e "s/\${NODE_EXPORTER_URL}/$NODE_EXPORTER_URL/g" docker-compose.yml
|
||||||
zip deploy.zip docker-compose.yml -r .ebextensions
|
zip deploy.zip docker-compose.yml -r .ebextensions
|
||||||
|
|
||||||
- name: Deploy AWS Beanstalk
|
- name: Deploy AWS Beanstalk
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ services:
|
|||||||
- .env
|
- .env
|
||||||
|
|
||||||
node_exporter:
|
node_exporter:
|
||||||
image: prom/node-exporter:v1.3.1
|
image: ${NODE_EXPORTER_URL}
|
||||||
container_name: node_exporter
|
container_name: node_exporter
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
+1
-1
@@ -46,6 +46,7 @@ import { ProductboardModule } from './modules/productboard/productboard.module';
|
|||||||
NetworkConfigModule,
|
NetworkConfigModule,
|
||||||
ConnectionTestModule,
|
ConnectionTestModule,
|
||||||
PipelinesModule,
|
PipelinesModule,
|
||||||
|
PipelinesV2Module,
|
||||||
TransformationsModule,
|
TransformationsModule,
|
||||||
HealthModule,
|
HealthModule,
|
||||||
CatalogModule,
|
CatalogModule,
|
||||||
@@ -53,7 +54,6 @@ import { ProductboardModule } from './modules/productboard/productboard.module';
|
|||||||
RolesModule,
|
RolesModule,
|
||||||
InputsModule,
|
InputsModule,
|
||||||
OauthModule,
|
OauthModule,
|
||||||
PipelinesV2Module,
|
|
||||||
CatalogModule,
|
CatalogModule,
|
||||||
ProductboardModule,
|
ProductboardModule,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ export const PERMISSIONS_GROUPS = {
|
|||||||
DELETE: {
|
DELETE: {
|
||||||
seqid: 38,
|
seqid: 38,
|
||||||
claim: 'connection:delete',
|
claim: 'connection:delete',
|
||||||
usage: PermissionUsages.INTERNAL,
|
usage: PermissionUsages.PUBLIC,
|
||||||
name: {
|
name: {
|
||||||
'pt-br': 'Excluir Fonte',
|
'pt-br': 'Excluir Fonte',
|
||||||
'en-us': 'Remove Source',
|
'en-us': 'Remove Source',
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import {
|
|||||||
Catch,
|
Catch,
|
||||||
ArgumentsHost,
|
ArgumentsHost,
|
||||||
HttpException,
|
HttpException,
|
||||||
HttpStatus,
|
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { Response } from 'express';
|
import { Response } from 'express';
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import {
|
|||||||
Param,
|
Param,
|
||||||
Patch,
|
Patch,
|
||||||
Post,
|
Post,
|
||||||
|
UseFilters,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { InputsService } from './inputs.service';
|
import { InputsService } from './inputs.service';
|
||||||
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
||||||
@@ -26,8 +27,11 @@ import {
|
|||||||
import { UpdateInputRequest } from './dtos/old_interfaces';
|
import { UpdateInputRequest } from './dtos/old_interfaces';
|
||||||
import { RequestUser, User } from 'src/authentication/user.decorator';
|
import { RequestUser, User } from 'src/authentication/user.decorator';
|
||||||
import { Info } from '@dadosfera/protospack-v2/dist/lib/Input/interfaces/entities';
|
import { Info } from '@dadosfera/protospack-v2/dist/lib/Input/interfaces/entities';
|
||||||
|
import ErrorBuilder from 'src/utils/ErrorBuilder';
|
||||||
|
import ErrorCodes from 'src/utils/errorCodes';
|
||||||
|
import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter';
|
||||||
|
|
||||||
@ApiTags('inputs')
|
@ApiTags('Inputs')
|
||||||
@Controller('inputs')
|
@Controller('inputs')
|
||||||
@AuthenticateCondition((req, user) => {
|
@AuthenticateCondition((req, user) => {
|
||||||
switch (req.method) {
|
switch (req.method) {
|
||||||
@@ -38,7 +42,9 @@ import { Info } from '@dadosfera/protospack-v2/dist/lib/Input/interfaces/entitie
|
|||||||
user.permissions.includes(
|
user.permissions.includes(
|
||||||
PERMISSIONS_GROUPS.PIPELINE.permissions.CREATE.seqid,
|
PERMISSIONS_GROUPS.PIPELINE.permissions.CREATE.seqid,
|
||||||
) ||
|
) ||
|
||||||
user.permissions.includes(PERMISSIONS_GROUPS.PIPELINE.permissions.UPDATE.seqid)
|
user.permissions.includes(
|
||||||
|
PERMISSIONS_GROUPS.PIPELINE.permissions.UPDATE.seqid,
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -49,10 +55,13 @@ import { Info } from '@dadosfera/protospack-v2/dist/lib/Input/interfaces/entitie
|
|||||||
user.permissions.includes(
|
user.permissions.includes(
|
||||||
PERMISSIONS_GROUPS.PIPELINE.permissions.UPDATE.seqid,
|
PERMISSIONS_GROUPS.PIPELINE.permissions.UPDATE.seqid,
|
||||||
) ||
|
) ||
|
||||||
user.permissions.includes(PERMISSIONS_GROUPS.PIPELINE.permissions.GET.seqid)
|
user.permissions.includes(
|
||||||
|
PERMISSIONS_GROUPS.PIPELINE.permissions.GET.seqid,
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@UseFilters(new GrpcToHttpExceptionFilter())
|
||||||
export class InputsController {
|
export class InputsController {
|
||||||
logger: DadosferaLogger;
|
logger: DadosferaLogger;
|
||||||
constructor(
|
constructor(
|
||||||
@@ -90,6 +99,7 @@ export class InputsController {
|
|||||||
@Post('/test-connection/get-columns')
|
@Post('/test-connection/get-columns')
|
||||||
@ApiOkResponse({ type: TestConnectionGetColumnsRes })
|
@ApiOkResponse({ type: TestConnectionGetColumnsRes })
|
||||||
async getColumns(@Body() data: TestConnectionGetColumnsReq) {
|
async getColumns(@Body() data: TestConnectionGetColumnsReq) {
|
||||||
|
throw new ErrorBuilder(ErrorCodes.NOT_IMPLEMENTED);
|
||||||
this.logger.info(
|
this.logger.info(
|
||||||
`/test-connection/get-columns - ON TEST CONNECTION GET COLUMNS ROUTE`,
|
`/test-connection/get-columns - ON TEST CONNECTION GET COLUMNS ROUTE`,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -72,17 +72,6 @@ export class InputsService {
|
|||||||
objectCamelToSnake(createInputResponse);
|
objectCamelToSnake(createInputResponse);
|
||||||
return createInputResponse;
|
return createInputResponse;
|
||||||
},
|
},
|
||||||
findOne: async (data: IIdRequest) => {
|
|
||||||
this.logger.info('InputClientService - FindOne');
|
|
||||||
const findOneInputResponse = await lastValueFrom(
|
|
||||||
this.inputReadService.InputFindOne(data),
|
|
||||||
).catch((e) => {
|
|
||||||
this.logger.error(e.details);
|
|
||||||
throw new HttpException(e.details, HttpStatus.INTERNAL_SERVER_ERROR);
|
|
||||||
});
|
|
||||||
objectCamelToSnake(findOneInputResponse);
|
|
||||||
return findOneInputResponse;
|
|
||||||
},
|
|
||||||
update: async (updateInputDTO: UpdateInputRequest) => {
|
update: async (updateInputDTO: UpdateInputRequest) => {
|
||||||
this.logger.info('InputClientService - Update');
|
this.logger.info('InputClientService - Update');
|
||||||
const updateInputResponse = await lastValueFrom(
|
const updateInputResponse = await lastValueFrom(
|
||||||
@@ -91,14 +80,6 @@ export class InputsService {
|
|||||||
|
|
||||||
return updateInputResponse;
|
return updateInputResponse;
|
||||||
},
|
},
|
||||||
remove: async (idRequest: IIdRequest) => {
|
|
||||||
this.logger.info('InputClientService - Remove');
|
|
||||||
const removeInputResponse = await lastValueFrom(
|
|
||||||
this.inputWriteService.InputRemove(idRequest),
|
|
||||||
);
|
|
||||||
|
|
||||||
return removeInputResponse;
|
|
||||||
},
|
|
||||||
testConnection: async (data: TestConnectionRequest) => {
|
testConnection: async (data: TestConnectionRequest) => {
|
||||||
this.logger.info('InputClientService - TestConnection');
|
this.logger.info('InputClientService - TestConnection');
|
||||||
const testConnectionResponse = await lastValueFrom(
|
const testConnectionResponse = await lastValueFrom(
|
||||||
@@ -239,17 +220,13 @@ export class InputsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findOne(idRequest: IIdRequest) {
|
async findOne(idRequest: IIdRequest) {
|
||||||
try {
|
const findOneInputResponse: any = await lastValueFrom(
|
||||||
const findOneInputResponse: any = await this.OLD_inputClient.findOne(
|
this.inputReadService.InputFindOne(idRequest),
|
||||||
idRequest,
|
);
|
||||||
);
|
findOneInputResponse.input = this.adjustInputPayload(
|
||||||
findOneInputResponse.input = this.adjustInputPayload(
|
findOneInputResponse.input,
|
||||||
findOneInputResponse.input,
|
);
|
||||||
);
|
return findOneInputResponse;
|
||||||
return findOneInputResponse;
|
|
||||||
} catch (err) {
|
|
||||||
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(id: string, data, info: Info) {
|
async update(id: string, data, info: Info) {
|
||||||
@@ -271,13 +248,7 @@ export class InputsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async remove(idRequest: IIdRequest) {
|
async remove(idRequest: IIdRequest) {
|
||||||
try {
|
return lastValueFrom(this.inputWriteService.InputRemove(idRequest));
|
||||||
const removeInputResponse = await this.OLD_inputClient.remove(idRequest);
|
|
||||||
|
|
||||||
return removeInputResponse;
|
|
||||||
} catch (err) {
|
|
||||||
throw new HttpException(err.message, HttpStatus.NOT_FOUND);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Timeout(60000 * 10) // Timeout set for 10 minutes
|
@Timeout(60000 * 10) // Timeout set for 10 minutes
|
||||||
|
|||||||
@@ -9,8 +9,15 @@ import {
|
|||||||
Put,
|
Put,
|
||||||
Headers,
|
Headers,
|
||||||
Query,
|
Query,
|
||||||
|
UseFilters,
|
||||||
|
HttpCode,
|
||||||
|
HttpStatus,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { ApiCreatedResponse, ApiTags } from '@nestjs/swagger';
|
import {
|
||||||
|
ApiCreatedResponse,
|
||||||
|
ApiNoContentResponse,
|
||||||
|
ApiTags,
|
||||||
|
} from '@nestjs/swagger';
|
||||||
import { AuthenticateCondition } from 'src/authentication/authentication.decorator';
|
import { AuthenticateCondition } from 'src/authentication/authentication.decorator';
|
||||||
import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum';
|
import { PERMISSIONS_GROUPS } from '../../authentication/permissions.enum';
|
||||||
import { PipelinesService } from './pipelines.service';
|
import { PipelinesService } from './pipelines.service';
|
||||||
@@ -21,7 +28,10 @@ import { PackTheMetadata } from 'src/utils/ PackTheMetadata';
|
|||||||
|
|
||||||
import { PipelinesService as OldPipelineService } from 'src/modules/pipelines/pipelines.service';
|
import { PipelinesService as OldPipelineService } from 'src/modules/pipelines/pipelines.service';
|
||||||
import { ICreatePipelineV2Req, IPipelineV2 } from './interfaces';
|
import { ICreatePipelineV2Req, IPipelineV2 } from './interfaces';
|
||||||
@ApiTags('Pipelines')
|
import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter';
|
||||||
|
|
||||||
|
@UseFilters(new GrpcToHttpExceptionFilter())
|
||||||
|
@ApiTags('PipelinesV2')
|
||||||
@Controller('pipelinesV2')
|
@Controller('pipelinesV2')
|
||||||
@AuthenticateCondition((req, user) => {
|
@AuthenticateCondition((req, user) => {
|
||||||
let action;
|
let action;
|
||||||
@@ -143,13 +153,16 @@ export class PipelinesController {
|
|||||||
const result = await this.pipelinesClientService
|
const result = await this.pipelinesClientService
|
||||||
.findOne({ id }, metadata)
|
.findOne({ id }, metadata)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
//{pipeline:{tables: {tables: [], input_id: ''}}}
|
||||||
|
let tables = JSON.parse(res.pipeline.config.tables);
|
||||||
|
if (tables?.tables) tables = tables?.tables;
|
||||||
Object.assign(res.pipeline, {
|
Object.assign(res.pipeline, {
|
||||||
transformations: res.pipeline.transformations
|
transformations: res.pipeline.transformations
|
||||||
? JSON.parse(res.pipeline.transformations)
|
? JSON.parse(res.pipeline.transformations)
|
||||||
: [],
|
: [],
|
||||||
config: {
|
config: {
|
||||||
cron: res.pipeline.config.cron,
|
cron: res.pipeline.config.cron,
|
||||||
tables: JSON.parse(res.pipeline.config.tables),
|
tables,
|
||||||
},
|
},
|
||||||
properties: res.pipeline.properties
|
properties: res.pipeline.properties
|
||||||
? JSON.parse(res.pipeline.properties)
|
? JSON.parse(res.pipeline.properties)
|
||||||
@@ -180,17 +193,17 @@ export class PipelinesController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Delete(':id')
|
@Delete(':id')
|
||||||
async delete(@Body() data, @Param() params, @User() user: RequestUser) {
|
@ApiNoContentResponse()
|
||||||
|
@HttpCode(HttpStatus.NO_CONTENT)
|
||||||
|
async delete(@Param() params, @User() user: RequestUser) {
|
||||||
|
this.logger.info('PipelinesController - delete', { user });
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
this.logger.info('PipelinesController - findOne', { user });
|
const metadata = PackTheMetadata({
|
||||||
|
customer_id: user.customer_id,
|
||||||
const metadata = PackTheMetadata({ ...user });
|
customer_name: user.customer_name,
|
||||||
|
user_id: user.user_id,
|
||||||
const response = await this.pipelinesClientService.remove(
|
});
|
||||||
{ id, ...data },
|
await this.pipelinesClientService.remove({ id, metadata, user });
|
||||||
metadata,
|
this.logger.info('PipelinesController - delete: OK');
|
||||||
);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import { PipelinesClientConfiguration } from './pipelines-client';
|
|||||||
|
|
||||||
import { PipelinesModule as OldPipelineModule } from 'src/modules/pipelines/pipelines.module';
|
import { PipelinesModule as OldPipelineModule } from 'src/modules/pipelines/pipelines.module';
|
||||||
import { ConnectorModule } from '../connector/connector.module';
|
import { ConnectorModule } from '../connector/connector.module';
|
||||||
|
import { InputsModule } from '../inputs/inputs.module';
|
||||||
|
import { TransformationsModule } from '../transformations/transformations.module';
|
||||||
|
|
||||||
const client = new PipelinesClientConfiguration();
|
const client = new PipelinesClientConfiguration();
|
||||||
|
|
||||||
@@ -17,6 +19,8 @@ const client = new PipelinesClientConfiguration();
|
|||||||
ClientsModule.register([client.providerOptions]),
|
ClientsModule.register([client.providerOptions]),
|
||||||
OldPipelineModule,
|
OldPipelineModule,
|
||||||
ConnectorModule,
|
ConnectorModule,
|
||||||
|
InputsModule,
|
||||||
|
TransformationsModule,
|
||||||
],
|
],
|
||||||
controllers: [PipelinesController],
|
controllers: [PipelinesController],
|
||||||
providers: [PipelinesService, DadosferaLogger],
|
providers: [PipelinesService, DadosferaLogger],
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
BadRequestException,
|
BadRequestException,
|
||||||
HttpException,
|
|
||||||
Inject,
|
Inject,
|
||||||
InternalServerErrorException,
|
InternalServerErrorException,
|
||||||
OnModuleInit,
|
OnModuleInit,
|
||||||
@@ -20,6 +19,9 @@ import { ICreatePipelineV2Req } from './interfaces';
|
|||||||
import { PipelineV2CreateRequest } from '@dadosfera/protospack-v2/dist/lib/PipelineV2/interfaces/messages';
|
import { PipelineV2CreateRequest } from '@dadosfera/protospack-v2/dist/lib/PipelineV2/interfaces/messages';
|
||||||
import { Metadata } from '@grpc/grpc-js';
|
import { Metadata } from '@grpc/grpc-js';
|
||||||
import { ConnectorClientService } from '../connector/client.service';
|
import { ConnectorClientService } from '../connector/client.service';
|
||||||
|
import { InputsService } from '../inputs/inputs.service';
|
||||||
|
import { RequestUser } from 'src/authentication/user.decorator';
|
||||||
|
import { TransformationsService } from '../transformations/transformations.service';
|
||||||
|
|
||||||
export class PipelinesService implements OnModuleInit {
|
export class PipelinesService implements OnModuleInit {
|
||||||
logger: DadosferaLogger;
|
logger: DadosferaLogger;
|
||||||
@@ -31,6 +33,8 @@ export class PipelinesService implements OnModuleInit {
|
|||||||
@Inject(PipelinesClientConfiguration.name)
|
@Inject(PipelinesClientConfiguration.name)
|
||||||
private readonly grpcClient: ClientGrpc,
|
private readonly grpcClient: ClientGrpc,
|
||||||
private readonly connectorService: ConnectorClientService,
|
private readonly connectorService: ConnectorClientService,
|
||||||
|
private readonly inputsService: InputsService,
|
||||||
|
private readonly transformationsService: TransformationsService,
|
||||||
) {
|
) {
|
||||||
this.logger = dadosferaLogger.logger;
|
this.logger = dadosferaLogger.logger;
|
||||||
}
|
}
|
||||||
@@ -129,10 +133,7 @@ export class PipelinesService implements OnModuleInit {
|
|||||||
|
|
||||||
const findOnePipelineResponse = await lastValueFrom(
|
const findOnePipelineResponse = await lastValueFrom(
|
||||||
this.pipelineReadService.PipelineV2FindOne(data, metadata),
|
this.pipelineReadService.PipelineV2FindOne(data, metadata),
|
||||||
).catch((err) => {
|
);
|
||||||
this.logger.error(err.message);
|
|
||||||
throw new Error(err);
|
|
||||||
});
|
|
||||||
this.logger.info('Done');
|
this.logger.info('Done');
|
||||||
|
|
||||||
return findOnePipelineResponse;
|
return findOnePipelineResponse;
|
||||||
@@ -143,39 +144,58 @@ export class PipelinesService implements OnModuleInit {
|
|||||||
|
|
||||||
const updatePipelineResponse = await lastValueFrom(
|
const updatePipelineResponse = await lastValueFrom(
|
||||||
this.pipelineWriteService.PipelineV2Update(UpdatePipelineRequest),
|
this.pipelineWriteService.PipelineV2Update(UpdatePipelineRequest),
|
||||||
)
|
);
|
||||||
.then((res) => {
|
this.logger.info('Done');
|
||||||
this.logger.info('Done');
|
|
||||||
return res;
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
this.logger.error(err.message);
|
|
||||||
throw new Error(err);
|
|
||||||
});
|
|
||||||
|
|
||||||
return updatePipelineResponse;
|
return updatePipelineResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove(data: Messages.PipelineV2RemoveRequest, metadata: Metadata) {
|
async remove(data: { id: string; metadata: Metadata; user: RequestUser }) {
|
||||||
this.logger.info('PipelinesClientService - Remove');
|
const { id, metadata, user } = data;
|
||||||
|
const info = {
|
||||||
|
user_id: user.user_id,
|
||||||
|
customer_id: user.customer_id,
|
||||||
|
customer: user.customer_name,
|
||||||
|
};
|
||||||
|
const { pipeline } = await lastValueFrom(
|
||||||
|
this.pipelineReadService.PipelineV2FindOne({ id }, metadata),
|
||||||
|
);
|
||||||
|
await lastValueFrom(
|
||||||
|
this.pipelineWriteService.PipelineV2Remove({ id }, metadata),
|
||||||
|
);
|
||||||
|
|
||||||
const removePipelineResponse = await lastValueFrom(
|
//{pipeline:{tables: {tables: [], input_id: ''}}}
|
||||||
this.pipelineWriteService.PipelineV2Remove(data, metadata),
|
const input = pipeline.config.tables
|
||||||
)
|
? JSON.parse(pipeline.config.tables)
|
||||||
.then((res) => {
|
: null;
|
||||||
this.logger.info('Done');
|
if (input)
|
||||||
return res;
|
await this.inputsService
|
||||||
})
|
.remove({
|
||||||
.catch((err) => {
|
id: input.input_id,
|
||||||
this.logger.error(err.message);
|
info,
|
||||||
console.log(err);
|
})
|
||||||
throw new HttpException(
|
.catch((error) =>
|
||||||
err.details,
|
this.logger.error('Could not delete input', {
|
||||||
err.details === 'Erro ao pausar pipeline na plataforma.' ? 409 : 500,
|
data: { input, error },
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
});
|
|
||||||
|
|
||||||
return removePipelineResponse;
|
const transformations: { id: string }[] = pipeline.transformations
|
||||||
|
? JSON.parse(pipeline.transformations)
|
||||||
|
: null;
|
||||||
|
if (transformations && transformations.length)
|
||||||
|
for (const transformation of transformations) {
|
||||||
|
await this.transformationsService
|
||||||
|
.remove({
|
||||||
|
id: transformation.id,
|
||||||
|
info,
|
||||||
|
})
|
||||||
|
.catch((error) =>
|
||||||
|
this.logger.error('Could not delete transformation', {
|
||||||
|
data: { transformation, error },
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async findOneProperties(id: string, metadata: Metadata) {
|
async findOneProperties(id: string, metadata: Metadata) {
|
||||||
|
|||||||
@@ -248,14 +248,48 @@ export function EnrichErrorCode(code: string) {
|
|||||||
code,
|
code,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
case ErrorCodes.PIPELINE.NOT_FOUND:
|
||||||
|
return {
|
||||||
|
statusCode: HttpStatus.NOT_FOUND,
|
||||||
|
error: 'Não encontramos a pipeline solicitada',
|
||||||
|
message:
|
||||||
|
'Tente realizar a ação novamente. Caso o erro persista, entre em contato com o suporte',
|
||||||
|
code,
|
||||||
|
};
|
||||||
|
|
||||||
|
case ErrorCodes.PIPELINE.PLATFORM_NOT_FOUND:
|
||||||
|
case ErrorCodes.PIPELINE.PLATFORM_BAD_REQUEST:
|
||||||
|
case ErrorCodes.PIPELINE.PLATFORM_UNKNOWN:
|
||||||
|
return {
|
||||||
|
statusCode: HttpStatus.BAD_GATEWAY,
|
||||||
|
error: 'Oops... Não foi possível realizar sua ação',
|
||||||
|
message:
|
||||||
|
'Houve um erro interno ao buscar por sua pipeline. Caso o erro persista, entre em contato com o suporte',
|
||||||
|
code,
|
||||||
|
};
|
||||||
|
case ErrorCodes.INPUT.NOT_FOUND:
|
||||||
|
return {
|
||||||
|
statusCode: HttpStatus.NOT_FOUND,
|
||||||
|
error: 'Oops... O recurso que você buscou não está disponível',
|
||||||
|
message:
|
||||||
|
'Não encontramos o recurso buscado. Caso o erro persista, entre em contato com o suporte',
|
||||||
|
code,
|
||||||
|
};
|
||||||
|
case ErrorCodes.NOT_IMPLEMENTED:
|
||||||
|
return {
|
||||||
|
statusCode: HttpStatus.NOT_FOUND,
|
||||||
|
error: 'Oops... O serviço que você está tentando acessar não existe!',
|
||||||
|
message: 'Caso o erro persista, entre em contato com o suporte',
|
||||||
|
code,
|
||||||
|
};
|
||||||
case ErrorCodes.INTERNAL:
|
case ErrorCodes.INTERNAL:
|
||||||
case ErrorCodes.UNKNOWN:
|
case ErrorCodes.UNKNOWN:
|
||||||
default:
|
default:
|
||||||
return {
|
return {
|
||||||
statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
|
statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
error: 'Desconhecido',
|
error: 'Oops... Não foi possível realizar sua ação',
|
||||||
message:
|
message:
|
||||||
'Erro desconhecido. Tente novamente ou entre em contato com o suporte',
|
'Ocorreu um erro desconhecido. Caso o erro persista, entre em contato com o suporte',
|
||||||
code: ErrorCodes.UNKNOWN,
|
code: ErrorCodes.UNKNOWN,
|
||||||
details: code,
|
details: code,
|
||||||
};
|
};
|
||||||
|
|||||||
+16
-1
@@ -51,17 +51,32 @@ const CONNECTION_TEST = {
|
|||||||
BAD_REQUEST: 'CONNECTION_TEST.BAD_REQUEST',
|
BAD_REQUEST: 'CONNECTION_TEST.BAD_REQUEST',
|
||||||
UNKNOWN: 'CONNECTION_TEST.UNKNOWN',
|
UNKNOWN: 'CONNECTION_TEST.UNKNOWN',
|
||||||
};
|
};
|
||||||
|
const PIPELINE = {
|
||||||
|
NOT_FOUND: 'PIPELINE.NOT_FOUND',
|
||||||
|
PLATFORM_NOT_FOUND: 'PIPELINE.PLATFORM_NOT_FOUND',
|
||||||
|
PLATFORM_BAD_REQUEST: 'PIPELINE.PLATFORM_BAD_REQUEST',
|
||||||
|
PLATFORM_UNKNOWN: 'PIPELINE.PLATFORM_UNKNOWN',
|
||||||
|
};
|
||||||
|
const INPUT = {
|
||||||
|
NOT_FOUND: 'INPUT.NOT_FOUND',
|
||||||
|
};
|
||||||
|
const TRANSFORMATION = {
|
||||||
|
NOT_FOUND: 'TRANSFORMATION.NOT_FOUND',
|
||||||
|
};
|
||||||
const ErrorCodes = {
|
const ErrorCodes = {
|
||||||
UNKNOWN: 'UNKNOWN',
|
UNKNOWN: 'UNKNOWN',
|
||||||
RATE_LIMIT: 'RATE_LIMIT',
|
RATE_LIMIT: 'RATE_LIMIT',
|
||||||
INTERNAL: 'INTERNAL',
|
INTERNAL: 'INTERNAL',
|
||||||
|
NOT_IMPLEMENTED: 'NOT_IMPLEMENTED',
|
||||||
AUTH,
|
AUTH,
|
||||||
ROLE,
|
ROLE,
|
||||||
TERMS_OF_USE,
|
TERMS_OF_USE,
|
||||||
USER,
|
USER,
|
||||||
CUSTOMER,
|
CUSTOMER,
|
||||||
CONNECTION_TEST,
|
CONNECTION_TEST,
|
||||||
|
PIPELINE,
|
||||||
|
INPUT,
|
||||||
|
TRANSFORMATION,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ErrorCodes;
|
export default ErrorCodes;
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user