FIX: Transformations

This commit is contained in:
Victor Radael
2022-09-05 13:06:31 -03:00
4 changed files with 42 additions and 17 deletions
@@ -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')
@@ -37,7 +37,7 @@ export class ConnectionTestService {
async connectionTestPing(
body: ConnectionTestPingReq,
customer_name: string,
user: RequestUser,
): Promise<ConnectionTestPingRes> {
const {
host: endpoint,
@@ -46,16 +46,44 @@ 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 metadata = PackTheMetadata({
customer_name,
customer_id,
user_id,
});
if (connection_id) {
const con = await this.connectionsService.getConnectionDetails({
body,
metadata,
});
const conPayload = JSON.parse(con.connection.properties);
const { plugin, network_config_id } = con.connection;
const { host, port, endpoint } = conPayload;
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,
+1 -1
View File
@@ -137,7 +137,7 @@ export class ConnectionClientService implements OnModuleInit {
body,
metadata,
}): Promise<GetConnectionDetailsResponse> {
const { id } = body;
const id = body.connection_id || body.id;
return lastValueFrom(
this.connectionServiceRead.GetConnectionDetails({ id }, metadata),
+1 -1
View File
File diff suppressed because one or more lines are too long