FIX: connections migration agora vai

This commit is contained in:
Gabriel Rosa
2022-09-12 20:13:12 -03:00
parent 2eea9787cd
commit 4b317778f7
2 changed files with 26 additions and 26 deletions
+25 -25
View File
@@ -204,38 +204,38 @@ export class ConnectionClientService implements OnModuleInit {
JSON.parse(connectorsStr).map((c) => c),
);
const { customers } = await this.usersService.findAllCustomers();
const promises: Promise<{
const customer_connections: {
customer_name: string;
customer_id: string;
productConnections: Record<string, any>[];
platformConnections: ConnectionApiConnection[];
productNetworkConfigs: Record<string, any>[];
platformNetworkConfigs: ConnectionsApiNetworkConfig[];
}>[] = [];
}[] = [];
for (const customer of customers) {
const { name: customer_name, id: customer_id } = customer;
customers.forEach((c) => {
const customer_name = c.name;
const customer_id = c.id;
promises.push(
this.INTERNAL_getAllConnections({ customer_name }).then((res) => ({
customer_name,
customer_id,
platformConnections: res.platformConnections
? JSON.parse(res.platformConnections)
: [],
productConnections: res.productConnections
? JSON.parse(res.productConnections)
: [],
productNetworkConfigs: res.productNetworkConfigs
? JSON.parse(res.productNetworkConfigs)
: [],
platformNetworkConfigs: res.platformNetworkConfigs
? JSON.parse(res.platformNetworkConfigs)
: [],
})),
);
});
const customer_connections = await Promise.all(promises);
const customer_connection = await this.INTERNAL_getAllConnections({
customer_name,
}).then((res) => ({
customer_name,
customer_id,
platformConnections: res.platformConnections
? JSON.parse(res.platformConnections)
: [],
productConnections: res.productConnections
? JSON.parse(res.productConnections)
: [],
productNetworkConfigs: res.productNetworkConfigs
? JSON.parse(res.productNetworkConfigs)
: [],
platformNetworkConfigs: res.platformNetworkConfigs
? JSON.parse(res.platformNetworkConfigs)
: [],
}));
customer_connections.push(customer_connection);
}
this.logger.info(
'DEBUG_ConnectionsMigrations - ' + JSON.stringify(customer_connections),
);