FIX: Findone pipeline

This commit is contained in:
Gabriel Rosa
2022-09-08 17:12:24 -03:00
parent c64529a37c
commit d724c1644b
2 changed files with 24 additions and 16 deletions
+23 -15
View File
@@ -130,22 +130,30 @@ export class PipelinesController {
let result: any = [];
if (id.split('_').length > 1) {
result = await this.pipelinesClientService.findOne({ id }, metadata);
Object.assign(result.pipeline, {
transformations: JSON.parse(result.pipeline.transformations),
config: {
cron: result.pipeline.config.cron,
tables: JSON.parse(result.pipeline.config.tables),
},
result = await this.pipelinesClientService
.findOne({ id }, metadata)
.then((res) => {
Object.assign(res.pipeline, {
transformations: res.pipeline.transformations
? JSON.parse(res.pipeline.transformations)
: [],
config: {
cron: res.pipeline.config.cron,
tables: JSON.parse(res.pipeline.config.tables),
},
properties: res.pipeline.properties
? JSON.parse(res.pipeline.properties)
: {},
});
return res;
})
.catch(async (err) => {
this.logger.error(err);
return await this.oldPipelinesService.findOne({
id,
info: { customer_id, customer: customer_name, user_id },
});
});
} else {
result = await this.oldPipelinesService.findOne({
id,
info: { customer_id, customer: customer_name, user_id },
});
}
return result;
}