FEAT: Connection Details new version

This commit is contained in:
Victor Radael
2022-08-26 19:24:03 -03:00
parent 0f079a7b22
commit e94ace09d0
4 changed files with 19 additions and 29 deletions
-1
View File
@@ -16,7 +16,6 @@ export class ConnectionClientConfiguration {
ConnectionManager.ProtoPackages.WritePackage,
ConnectionManager.ProtoPackages.ReadPackage,
],
// credentials: undefined,
credentials:
process.env.LOCAL_ENV || process.env.ENV === 'local'
? undefined
+1
View File
@@ -183,6 +183,7 @@ export class ConnectionClientService implements OnModuleInit {
meta.add('customer_id', info.customer_id);
meta.add('customer_name', info.customer_name);
meta.add('user_id', info.user_id);
meta.add('details', info.details);
const { id } = body;
+17 -27
View File
@@ -123,28 +123,10 @@ export class ConnectionController {
@Get('/:id')
// @RequireAllPermissions(Permissions.CONNECTIONS.CREATE)
async getConnection(
@User() user,
@Headers('Dadosfera-Lang') language,
@Param('id') id,
): Promise<ConnectionRes> {
this.logger.info('/connections - Get Connection');
const { user_id, customer_id, customer_name } = user;
const response: any = await this.clientService.getConnection({
body: { id },
info: { user_id, customer_id, customer_name, language },
});
return response;
}
@Get('/:id/details')
// @RequireAllPermissions(Permissions.CONNECTIONS.CREATE)
async getConnectionDetails(
@User() user,
@Param('id') id,
@Query('details') details,
): Promise<ConnectionDetailsRes> {
this.logger.info('/connections - Get Connection Details');
@@ -152,17 +134,25 @@ export class ConnectionController {
const response: any = await this.clientService.getConnectionDetails({
body: { id },
info: { user_id, customer_id, customer_name },
info: { user_id, customer_id, customer_name, details },
});
delete response.connection.user_id;
delete response.connection.customer_id;
delete response.connection.customer_name;
if (details === 'true') {
const properties = JSON.parse(response.connection.properties);
Object.assign(response.connection, {
pipelines: JSON.parse(response.connection.pipelines),
connection_controls: properties.connection_controls,
config_controls: properties.config_controls,
connection_steps: properties.connection_steps,
});
Object.assign(response.connection, {
properties: JSON.parse(response.connection.properties),
pipelines: JSON.parse(response.connection.pipelines),
});
delete response.connection.properties;
} else {
Object.assign(response.connection, {
properties: JSON.parse(response.connection.properties),
pipelines: JSON.parse(response.connection.pipelines),
});
}
return response;
}