mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-29 18:50:05 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7062efc60 | ||
|
|
4a3dd98977 | ||
|
|
703b5f36b3 | ||
|
|
54d10cb873 | ||
|
|
3c877b8b8d | ||
|
|
e6b0034805 | ||
|
|
b9c1f784d3 | ||
|
|
3edf5c2416 | ||
|
|
f3e00a15c8 | ||
|
|
0422c7a369 | ||
|
|
f22d9370db | ||
|
|
a9ee74724f |
+1
-1
@@ -946,7 +946,7 @@
|
|||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
"200": {
|
"200": {
|
||||||
"description": "List of users of a customer",
|
"description": "",
|
||||||
"content": {
|
"content": {
|
||||||
"application/json": {
|
"application/json": {
|
||||||
"schema": {
|
"schema": {
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ function configureSwagger(app: INestApplication) {
|
|||||||
const document = SwaggerModule.createDocument(app, config);
|
const document = SwaggerModule.createDocument(app, config);
|
||||||
|
|
||||||
if (process.env.ENV === 'local') SwaggerModule.setup('api', app, document);
|
if (process.env.ENV === 'local') SwaggerModule.setup('api', app, document);
|
||||||
|
|
||||||
writeFileSync(
|
writeFileSync(
|
||||||
'docsfera.json',
|
'docsfera.json',
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
|
|||||||
@@ -89,9 +89,9 @@ export class ConnectorClientService implements OnModuleInit {
|
|||||||
const connectorErrors = connectorsResponse
|
const connectorErrors = connectorsResponse
|
||||||
.filter((i) => i.update.error)
|
.filter((i) => i.update.error)
|
||||||
.map((i) => ({
|
.map((i) => ({
|
||||||
id: i.update._id,
|
id: i.update?._id,
|
||||||
reason: i.update.error,
|
reason: i.update?.error,
|
||||||
status: i.error.status,
|
status: i.error?.status,
|
||||||
}));
|
}));
|
||||||
const connectorCreated = connectorsResponse
|
const connectorCreated = connectorsResponse
|
||||||
.filter((i) => i.update.result === 'created')
|
.filter((i) => i.update.result === 'created')
|
||||||
|
|||||||
@@ -1,9 +1,4 @@
|
|||||||
import {
|
import { BadRequestException, Inject, OnModuleInit } from '@nestjs/common';
|
||||||
BadRequestException,
|
|
||||||
Inject,
|
|
||||||
InternalServerErrorException,
|
|
||||||
OnModuleInit,
|
|
||||||
} from '@nestjs/common';
|
|
||||||
import { ClientGrpc } from '@nestjs/microservices';
|
import { ClientGrpc } from '@nestjs/microservices';
|
||||||
import {
|
import {
|
||||||
Messages,
|
Messages,
|
||||||
@@ -23,6 +18,8 @@ import { InputsService } from '../inputs/inputs.service';
|
|||||||
import { RequestUser } from 'src/authentication/user.decorator';
|
import { RequestUser } from 'src/authentication/user.decorator';
|
||||||
import { TransformationsService } from '../transformations/transformations.service';
|
import { TransformationsService } from '../transformations/transformations.service';
|
||||||
import { getObjValueFromPath } from 'src/utils/ObjValueFromPath';
|
import { getObjValueFromPath } from 'src/utils/ObjValueFromPath';
|
||||||
|
import ErrorCodes from 'src/utils/errorCodes';
|
||||||
|
import ErrorBuilder from 'src/utils/ErrorBuilder';
|
||||||
|
|
||||||
export class PipelinesService implements OnModuleInit {
|
export class PipelinesService implements OnModuleInit {
|
||||||
logger: DadosferaLogger;
|
logger: DadosferaLogger;
|
||||||
@@ -99,7 +96,7 @@ export class PipelinesService implements OnModuleInit {
|
|||||||
const [errorType, message] = error.details.split('|');
|
const [errorType, message] = error.details.split('|');
|
||||||
throw new BadRequestException(message);
|
throw new BadRequestException(message);
|
||||||
}
|
}
|
||||||
throw new InternalServerErrorException(error.details);
|
throw new ErrorBuilder(error.details);
|
||||||
});
|
});
|
||||||
this.logger.info('Done');
|
this.logger.info('Done');
|
||||||
|
|
||||||
@@ -164,45 +161,53 @@ export class PipelinesService implements OnModuleInit {
|
|||||||
customer_id: user.customer_id,
|
customer_id: user.customer_id,
|
||||||
customer: user.customer_name,
|
customer: user.customer_name,
|
||||||
};
|
};
|
||||||
|
let existsInProduct = true;
|
||||||
const { pipeline } = await lastValueFrom(
|
const { pipeline } = await lastValueFrom(
|
||||||
this.pipelineReadService.PipelineV2FindOne({ id }, metadata),
|
this.pipelineReadService.PipelineV2FindOne({ id }, metadata),
|
||||||
);
|
).catch((e) => {
|
||||||
|
if (e.details === ErrorCodes.PIPELINE.NOT_FOUND) existsInProduct = false;
|
||||||
|
else throw new ErrorBuilder(e.details);
|
||||||
|
|
||||||
|
return { pipeline: undefined };
|
||||||
|
});
|
||||||
await lastValueFrom(
|
await lastValueFrom(
|
||||||
this.pipelineWriteService.PipelineV2Remove({ id }, metadata),
|
this.pipelineWriteService.PipelineV2Remove({ id }, metadata),
|
||||||
);
|
);
|
||||||
|
|
||||||
//{pipeline:{tables: {tables: [], input_id: ''}}}
|
if (existsInProduct) {
|
||||||
const input = pipeline.config.tables
|
//{pipeline:{tables: {tables: [], input_id: ''}}}
|
||||||
? JSON.parse(pipeline.config.tables)
|
const input = pipeline.config.tables
|
||||||
: null;
|
? JSON.parse(pipeline.config.tables)
|
||||||
if (input)
|
: null;
|
||||||
await this.inputsService
|
if (input)
|
||||||
.remove({
|
await this.inputsService
|
||||||
id: input.input_id,
|
|
||||||
info,
|
|
||||||
})
|
|
||||||
.catch((error) =>
|
|
||||||
this.logger.error('Could not delete input', {
|
|
||||||
data: { input, error },
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
const transformations: { id: string }[] = pipeline.transformations
|
|
||||||
? JSON.parse(pipeline.transformations)
|
|
||||||
: null;
|
|
||||||
if (transformations && transformations.length)
|
|
||||||
for (const transformation of transformations) {
|
|
||||||
await this.transformationsService
|
|
||||||
.remove({
|
.remove({
|
||||||
id: transformation.id,
|
id: input.input_id,
|
||||||
info,
|
info,
|
||||||
})
|
})
|
||||||
.catch((error) =>
|
.catch((error) =>
|
||||||
this.logger.error('Could not delete transformation', {
|
this.logger.error('Could not delete input', {
|
||||||
data: { transformation, error },
|
data: { input, error },
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
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) {
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ import { Metadata } from '@grpc/grpc-js';
|
|||||||
import ErrorBuilder from 'src/utils/ErrorBuilder';
|
import ErrorBuilder from 'src/utils/ErrorBuilder';
|
||||||
import ErrorCodes from 'src/utils/errorCodes';
|
import ErrorCodes from 'src/utils/errorCodes';
|
||||||
|
|
||||||
// TODO GET de hierarquias e do PATCH em usuário
|
|
||||||
@ApiTags('Users')
|
@ApiTags('Users')
|
||||||
@Controller('users')
|
@Controller('users')
|
||||||
@ApiHeader({
|
@ApiHeader({
|
||||||
@@ -75,10 +74,6 @@ export class UsersController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
@ApiOkResponse({
|
|
||||||
type: GetAllUsersByCustomerIdRes,
|
|
||||||
description: 'List of users of a customer',
|
|
||||||
})
|
|
||||||
async getAllUsersByCustomerId(
|
async getAllUsersByCustomerId(
|
||||||
@User() user: RequestUser,
|
@User() user: RequestUser,
|
||||||
@Headers('dadosfera-lang') language,
|
@Headers('dadosfera-lang') language,
|
||||||
|
|||||||
Reference in New Issue
Block a user