mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-17 02:19:08 +00:00
FEAT: Connection Details new version
This commit is contained in:
@@ -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