mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-17 20:29:09 +00:00
FIX: Ping route adapted to use connection_id
This commit is contained in:
@@ -52,10 +52,7 @@ export class ConnectionTestController {
|
||||
user: user.user_id,
|
||||
customer: user.customer_name,
|
||||
});
|
||||
return this.connectionTestService.connectionTestPing(
|
||||
body,
|
||||
user.customer_name,
|
||||
);
|
||||
return this.connectionTestService.connectionTestPing(body, user);
|
||||
}
|
||||
|
||||
@Post('credentials')
|
||||
|
||||
@@ -36,7 +36,7 @@ export class ConnectionTestService {
|
||||
|
||||
async connectionTestPing(
|
||||
body: ConnectionTestPingReq,
|
||||
customer_name: string,
|
||||
user: RequestUser,
|
||||
): Promise<ConnectionTestPingRes> {
|
||||
const {
|
||||
host: endpoint,
|
||||
@@ -45,16 +45,41 @@ export class ConnectionTestService {
|
||||
network_config_id,
|
||||
connection_id,
|
||||
} = body;
|
||||
return lastValueFrom(
|
||||
this.connectionTestReadClient.ConnectionTestPing({
|
||||
customer_name,
|
||||
endpoint,
|
||||
network_config_id,
|
||||
plugin,
|
||||
port: port ? port.toString() : undefined,
|
||||
connection_id,
|
||||
}),
|
||||
);
|
||||
const { user_id, customer_id, customer_name } = user;
|
||||
const info = { customer_name, customer_id, user_id };
|
||||
|
||||
if (connection_id) {
|
||||
const con = await this.connectionsService.getConnectionDetails({
|
||||
body,
|
||||
info,
|
||||
});
|
||||
const conPayload = JSON.parse(con.connection.properties);
|
||||
const { plugin, network_config_id } = con.connection;
|
||||
const { host, port, endpoint } = conPayload;
|
||||
console.log(plugin);
|
||||
|
||||
return lastValueFrom(
|
||||
this.connectionTestReadClient.ConnectionTestPing({
|
||||
customer_name,
|
||||
endpoint: endpoint || host,
|
||||
network_config_id,
|
||||
plugin,
|
||||
port: port ? port.toString() : undefined,
|
||||
connection_id,
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
return lastValueFrom(
|
||||
this.connectionTestReadClient.ConnectionTestPing({
|
||||
customer_name,
|
||||
endpoint,
|
||||
network_config_id,
|
||||
plugin,
|
||||
port: port ? port.toString() : undefined,
|
||||
connection_id,
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
async connectionTestCredentials(
|
||||
body: ConnectionTestCredentialsReq,
|
||||
|
||||
@@ -185,7 +185,7 @@ export class ConnectionClientService implements OnModuleInit {
|
||||
meta.add('user_id', info.user_id);
|
||||
meta.add('details', info.details);
|
||||
|
||||
const { id } = body;
|
||||
const id = body.connection_id || body.id;
|
||||
|
||||
return lastValueFrom(
|
||||
this.connectionServiceRead.GetConnectionDetails({ id }, meta),
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user