Compare commits

...
7 Commits
6 changed files with 30 additions and 42 deletions
+2 -10
View File
@@ -1544,24 +1544,16 @@
} }
}, },
"info": { "info": {
"title": "Maestro - fix/upload-files", "title": "Maestro - fix/delete-connector",
"description": "This is the Maestro API", "description": "This is the Maestro API",
"version": "1.0.0", "version": "1.0.0",
"contact": {} "contact": {}
}, },
"tags": [], "tags": [],
"servers": [ "servers": [
{
"url": "https://maestro.stg.dadosfera.ai",
"description": "Ambiente STG"
},
{
"url": "https://maestro-2.stg.dadosfera.ai",
"description": "Ambiente STG2"
},
{ {
"url": "https://maestro.dadosfera.ai", "url": "https://maestro.dadosfera.ai",
"description": "Ambiente PRD" "description": "Dadosfera API"
} }
], ],
"components": { "components": {
+2 -15
View File
@@ -4716,26 +4716,13 @@
} }
}, },
"info": { "info": {
"title": "Maestro - fix/upload-files", "title": "Maestro - fix/delete-connector",
"description": "This is the Maestro API", "description": "This is the Maestro API",
"version": "1.0.0", "version": "1.0.0",
"contact": {} "contact": {}
}, },
"tags": [], "tags": [],
"servers": [ "servers": [],
{
"url": "https://maestro.stg.dadosfera.ai",
"description": "Ambiente STG"
},
{
"url": "https://maestro-2.stg.dadosfera.ai",
"description": "Ambiente STG2"
},
{
"url": "https://maestro.dadosfera.ai",
"description": "Ambiente PRD"
}
],
"components": { "components": {
"securitySchemes": { "securitySchemes": {
"access-token": { "access-token": {
+7 -6
View File
@@ -42,7 +42,7 @@ function configureSwagger(app: INestApplication) {
} }
const swaggerTitle = branchName ? `Maestro - ${branchName}` : 'Maestro'; const swaggerTitle = branchName ? `Maestro - ${branchName}` : 'Maestro';
const config = new DocumentBuilder() const swaggerConfig = new DocumentBuilder()
.setTitle(swaggerTitle) .setTitle(swaggerTitle)
.setDescription('Documentation for Maestro gateway') .setDescription('Documentation for Maestro gateway')
.addSecurity('access-token', { .addSecurity('access-token', {
@@ -50,11 +50,12 @@ function configureSwagger(app: INestApplication) {
name: 'Authorization', name: 'Authorization',
in: 'header', in: 'header',
}) })
.setDescription('This is the Maestro API') .setDescription('This is the Maestro API');
.addServer('https://maestro.stg.dadosfera.ai', 'Ambiente STG')
.addServer('https://maestro-2.stg.dadosfera.ai', 'Ambiente STG2') if (process.env.INTERNAL_SWAGGER !== 'true')
.addServer('https://maestro.dadosfera.ai', 'Ambiente PRD') swaggerConfig.addServer('https://maestro.dadosfera.ai', 'Dadosfera API');
.build();
const config = swaggerConfig.build();
const document = SwaggerModule.createDocument(app, config); const document = SwaggerModule.createDocument(app, config);
@@ -273,16 +273,13 @@ export class ConnectorController {
@Param('plugin') plugin: string, @Param('plugin') plugin: string,
@Query('version') version: string, @Query('version') version: string,
) { ) {
this.logger.info('/upload - Upload Connector Route'); this.logger.info('DELETE /:plugin - Delete Connector Route');
const response: any = await this.connectorClientService.deleteConnector( const response = await this.connectorClientService.deleteConnector(
plugin, plugin,
version, version,
); );
return { return { message: response.message, connector: response.connector };
message: response.message || 'ok',
connector: { ...JSON.parse(response.connector) },
};
} }
} }
+12 -4
View File
@@ -233,15 +233,23 @@ export class PipelinesService implements OnModuleInit {
const config_controls = (connector.config_controls || []).filter( const config_controls = (connector.config_controls || []).filter(
(config_control) => { (config_control) => {
const path: string = config_control.name; const path: string = config_control.name;
if (!objHasPath({ object: { properties }, path })) return false; if (!objHasPath({ object: { properties }, path })) return false;
const default_value = getObjValueFromPath({ let default_value = getObjValueFromPath({
object: { properties }, object: { properties },
path, path,
}); });
if (default_value != undefined)
if (default_value != undefined) {
if (
path === 'properties.spreadsheet_id' &&
typeof default_value === 'string'
)
default_value = 'https://docs.google.com/spreadsheets/d/'.concat(
default_value,
);
config_control.default_value = default_value; config_control.default_value = default_value;
}
return true; return true;
}, },
@@ -251,7 +259,7 @@ export class PipelinesService implements OnModuleInit {
pipeline: { pipeline: {
...pipeline, ...pipeline,
config_controls, config_controls,
properties: properties, properties,
}, },
}; };
} }
+4 -1
View File
@@ -1,4 +1,7 @@
export function getObjValueFromPath<T>(data: { object: T; path: string }): T { export function getObjValueFromPath<T extends object>(data: {
object: T;
path: string;
}): any {
const { object, path } = data; const { object, path } = data;
const keys = path.split('.'); const keys = path.split('.');