mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-28 18:09:08 +00:00
Merge branch 'ft/connection-manager' of github.com:dadosfera/maestro into ft/connection-manager
This commit is contained in:
Generated
+12
-6
@@ -8201,8 +8201,9 @@
|
||||
"integrity": "sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A=="
|
||||
},
|
||||
"node_modules/moment": {
|
||||
"version": "2.29.3",
|
||||
"license": "MIT",
|
||||
"version": "2.29.4",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
|
||||
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
@@ -9983,9 +9984,10 @@
|
||||
}
|
||||
},
|
||||
"node_modules/terser": {
|
||||
"version": "5.14.0",
|
||||
"version": "5.14.2",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz",
|
||||
"integrity": "sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"@jridgewell/source-map": "^0.3.2",
|
||||
"acorn": "^8.5.0",
|
||||
@@ -16695,7 +16697,9 @@
|
||||
"integrity": "sha512-ySViT69/76t8VhE1xXHK6Ch4NcDd26gx0MzKXLO+F7NOtnqH68d9zF94nT8ZWSxXh8ELOERsnJO/sWt1xZYw5A=="
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.29.3"
|
||||
"version": "2.29.4",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz",
|
||||
"integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w=="
|
||||
},
|
||||
"moment-timezone": {
|
||||
"version": "0.5.34",
|
||||
@@ -17891,7 +17895,9 @@
|
||||
}
|
||||
},
|
||||
"terser": {
|
||||
"version": "5.14.0",
|
||||
"version": "5.14.2",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.14.2.tgz",
|
||||
"integrity": "sha512-oL0rGeM/WFQCUd0y2QrWxYnq7tfSuKBiqTjRPWrRgB46WD/kiwHwF8T23z78H6Q6kGCuuHcPB+KULHRdxvVGQA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@jridgewell/source-map": "^0.3.2",
|
||||
|
||||
+2
-4
@@ -4,8 +4,6 @@ import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
||||
import helmet from 'helmet';
|
||||
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
||||
|
||||
import documentEmpty from '../swagger_empty.json';
|
||||
|
||||
import { AppModule } from './app.module';
|
||||
import { writeFileSync } from 'fs';
|
||||
async function bootstrap() {
|
||||
@@ -43,8 +41,8 @@ async function bootstrap() {
|
||||
|
||||
await writeFileSync('swagger.json', JSON.stringify(document));
|
||||
|
||||
// if (process.env.ENV != 'stg' && process.env.ENV != 'prd')
|
||||
// SwaggerModule.setup('api', app, document);
|
||||
if (process.env.ENV != 'stg' && process.env.ENV != 'prd')
|
||||
SwaggerModule.setup('api', app, document);
|
||||
|
||||
// const swaggerDoc = process.env.ENV === 'dev' ? document : documentEmpty;
|
||||
// SwaggerModule.setup('api', app, swaggerDoc);
|
||||
|
||||
@@ -15,7 +15,10 @@ import {
|
||||
GetTableMetadataRes,
|
||||
} from './dto/connection-test';
|
||||
import { ConnectionClientService } from '../connection/client.service';
|
||||
import { CreateConnectionDto } from '../connection/dtos/connection';
|
||||
import {
|
||||
CreateConnectionDto,
|
||||
DatabaseConnectionPropertiesDto,
|
||||
} from '../connection/dtos/connection';
|
||||
import { RequestUser } from 'src/authentication/user.decorator';
|
||||
|
||||
@Injectable()
|
||||
@@ -35,14 +38,14 @@ export class ConnectionTestService {
|
||||
body: ConnectionTestPingReq,
|
||||
customer_name: string,
|
||||
): Promise<ConnectionTestPingRes> {
|
||||
const { endpoint, plugin, port, network_config_id } = body;
|
||||
const { host: endpoint, plugin, port, network_config_id } = body;
|
||||
return lastValueFrom(
|
||||
this.connectionTestReadClient.ConnectionTestPing({
|
||||
customer_name,
|
||||
endpoint,
|
||||
network_config_id,
|
||||
plugin,
|
||||
port,
|
||||
port: port.toString(),
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -56,11 +59,14 @@ export class ConnectionTestService {
|
||||
|
||||
/********* CREATE CONNECTION *********/
|
||||
if (!connection_id) {
|
||||
if (!connectionBody.properties.credentials_type)
|
||||
connectionBody.properties.credentials_type = 'basic_auth';
|
||||
|
||||
const properties: DatabaseConnectionPropertiesDto = {
|
||||
...connectionBody.properties,
|
||||
plugin,
|
||||
credentials_type: 'basic_auth',
|
||||
};
|
||||
const createConnectionBody: CreateConnectionDto = {
|
||||
...body,
|
||||
properties,
|
||||
};
|
||||
const { connection } = await this.connectionsService.createConnection(
|
||||
createConnectionBody,
|
||||
@@ -82,11 +88,13 @@ export class ConnectionTestService {
|
||||
});
|
||||
throw e;
|
||||
});
|
||||
if (!operation_result)
|
||||
if (!operation_result) {
|
||||
await this.connectionsService.deleteConnection({
|
||||
body: { id: connection_id },
|
||||
info: { customer_id, customer_name, user_id },
|
||||
});
|
||||
connection_id = null;
|
||||
}
|
||||
return { operation_result, connection_id };
|
||||
}
|
||||
async connectionTestListSchemas(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ApiProperty, ApiPropertyOptional, OmitType } from '@nestjs/swagger';
|
||||
import { IsString, IsOptional } from 'class-validator';
|
||||
import { IsString, IsOptional, IsNumber, Max } from 'class-validator';
|
||||
import { DatabaseConnectionPropertiesDto } from 'src/modules/connection/dtos/connection';
|
||||
import { CreateConnectionDto } from 'src/modules/connection/dtos/connection';
|
||||
export class ColumnDto {
|
||||
@@ -22,11 +22,12 @@ export class ConnectionTestPingReq {
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
endpoint: string;
|
||||
host: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
port: string;
|
||||
@IsNumber()
|
||||
@Max(65535)
|
||||
port: number;
|
||||
|
||||
@ApiPropertyOptional()
|
||||
@IsOptional()
|
||||
@@ -39,16 +40,16 @@ export class ConnectionTestPingRes {
|
||||
operation_result: boolean;
|
||||
}
|
||||
|
||||
export class ConnectionTestCredentialsProperties extends OmitType(
|
||||
DatabaseConnectionPropertiesDto,
|
||||
['plugin', 'credentials_type'],
|
||||
) {}
|
||||
export class ConnectionTestCredentialsReq extends OmitType(
|
||||
CreateConnectionDto,
|
||||
['properties'],
|
||||
) {
|
||||
@ApiProperty()
|
||||
plugin: string;
|
||||
|
||||
@ApiProperty()
|
||||
properties: DatabaseConnectionPropertiesDto;
|
||||
|
||||
properties: ConnectionTestCredentialsProperties;
|
||||
@ApiPropertyOptional()
|
||||
connection_id?: string;
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"openapi": "3.0.0",
|
||||
"paths": {
|
||||
},
|
||||
"info": {
|
||||
"title": "404",
|
||||
"description": "",
|
||||
"version": "",
|
||||
"contact": {}
|
||||
},
|
||||
"tags": [],
|
||||
"servers": [],
|
||||
"components": {
|
||||
|
||||
"schemas": {}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user