mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-08 09:49:08 +00:00
FEAT: Connection test creating connection
- If any error occurs, connection is deleted - If operation_result is false, connection is deleted
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
HttpStatus,
|
||||
Inject,
|
||||
Post,
|
||||
UseFilters,
|
||||
ValidationPipe,
|
||||
} from '@nestjs/common';
|
||||
import { ApiOkResponse, ApiTags } from '@nestjs/swagger';
|
||||
@@ -24,9 +25,11 @@ import {
|
||||
} from './dto/connection-test';
|
||||
import { DadosferaLogger } from 'dadosfera-logs';
|
||||
import { Authenticated } from 'src/authentication/authentication.decorator';
|
||||
import { GrpcToHttpExceptionFilter } from 'src/error/grpc-to-http-exception.filter';
|
||||
|
||||
@ApiTags('Connection Test')
|
||||
@Controller('connection-test')
|
||||
@UseFilters(new GrpcToHttpExceptionFilter())
|
||||
@Authenticated()
|
||||
export class ConnectionTestController {
|
||||
logger: any;
|
||||
@@ -60,16 +63,13 @@ export class ConnectionTestController {
|
||||
@HttpCode(HttpStatus.OK)
|
||||
async connectionTestCredentials(
|
||||
@User() user: RequestUser,
|
||||
@Body(new ValidationPipe()) body: ConnectionTestCredentialsReq,
|
||||
@Body() body: ConnectionTestCredentialsReq,
|
||||
) {
|
||||
this.logger.info('/connection-test/credentials', {
|
||||
user: user.user_id,
|
||||
customer: user.customer_name,
|
||||
});
|
||||
return this.connectionTestService.connectionTestCredentials(
|
||||
body,
|
||||
user.customer_name,
|
||||
);
|
||||
return this.connectionTestService.connectionTestCredentials(body, user);
|
||||
}
|
||||
|
||||
@Post('schemas')
|
||||
@@ -113,7 +113,7 @@ export class ConnectionTestController {
|
||||
@User() user: RequestUser,
|
||||
@Body(new ValidationPipe()) body: GetTableMetadataReq,
|
||||
) {
|
||||
this.logger.info('/connection-test/tables', {
|
||||
this.logger.info('/connection-test/table-metadata', {
|
||||
user: user.user_id,
|
||||
customer: user.customer_name,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user