mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-20 02:59:08 +00:00
FEAT: Connection Details new version
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user