FIX: fixed some merge conflicts

This commit is contained in:
rodrigo.zamboni
2022-09-05 11:30:16 -03:00
19 changed files with 619 additions and 117 deletions
+10 -58
View File
@@ -1,4 +1,3 @@
import { Metadata } from '@grpc/grpc-js';
import {
OnModuleInit,
Inject,
@@ -39,13 +38,8 @@ export class ConnectionClientService implements OnModuleInit {
async createConnection(
body: CreateConnectionDto,
info: any,
metadata,
): Promise<ConnectionRes> {
const meta = new Metadata();
meta.add('customer_id', info.customer_id);
meta.add('customer_name', info.customer_name);
meta.add('user_id', info.user_id);
const {
connector_id,
description,
@@ -69,7 +63,7 @@ export class ConnectionClientService implements OnModuleInit {
properties: JSON.stringify(properties),
type,
},
meta,
metadata,
),
).catch((err) => {
throw new HttpException(
@@ -82,14 +76,8 @@ export class ConnectionClientService implements OnModuleInit {
async updateConnection(
id: string,
body: UpdateConnectionDto,
info,
metadata,
): Promise<ConnectionRes> {
const meta = new Metadata();
meta.add('customer_id', info.customer_id);
meta.add('customer_name', info.customer_name);
meta.add('user_id', info.user_id);
meta.add('language', info.language);
const { description, name, network_config_id, properties } = body;
return lastValueFrom(
@@ -101,7 +89,7 @@ export class ConnectionClientService implements OnModuleInit {
network_config_id,
properties: JSON.stringify(properties),
},
meta,
metadata,
),
).catch((err) => {
throw new HttpException(
@@ -111,12 +99,7 @@ export class ConnectionClientService implements OnModuleInit {
});
}
async deleteConnection({ body, info }): Promise<ConnectionRes> {
const meta = new Metadata();
meta.add('customer_id', info.customer_id);
meta.add('customer_name', info.customer_name);
meta.add('user_id', info.user_id);
async deleteConnection({ body, metadata }): Promise<ConnectionRes> {
const { id } = body;
return lastValueFrom(
@@ -124,7 +107,7 @@ export class ConnectionClientService implements OnModuleInit {
{
id,
},
meta,
metadata,
),
).catch((err) => {
throw new HttpException(
@@ -134,19 +117,13 @@ export class ConnectionClientService implements OnModuleInit {
});
}
async getAllConnection({ body, info }): Promise<ConnectionsRes> {
const meta = new Metadata();
meta.add('customer_id', info.customer_id);
meta.add('customer_name', info.customer_name);
meta.add('user_id', info.user_id);
meta.add('language', info.language);
async getAllConnection({ body, metadata }): Promise<ConnectionsRes> {
const { search, filters, size, page } = body;
return lastValueFrom(
this.connectionServiceRead.GetAllConnection(
{ search, filters: JSON.stringify(filters), size, page },
meta,
metadata,
),
).catch((err) => {
throw new HttpException(
@@ -156,39 +133,14 @@ export class ConnectionClientService implements OnModuleInit {
});
}
async getConnection({ body, info }): Promise<ConnectionRes> {
const meta = new Metadata();
meta.add('customer_id', info.customer_id);
meta.add('customer_name', info.customer_name);
meta.add('user_id', info.user_id);
meta.add('language', info.language);
const { id } = body;
return lastValueFrom(
this.connectionServiceRead.GetConnection({ id }, meta),
).catch((err) => {
throw new HttpException(
err.details,
err.code === 6 ? HttpStatus.CONFLICT : 400,
);
});
}
async getConnectionDetails({
body,
info,
metadata,
}): Promise<GetConnectionDetailsResponse> {
const meta = new Metadata();
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.connection_id || body.id;
return lastValueFrom(
this.connectionServiceRead.GetConnectionDetails({ id }, meta),
this.connectionServiceRead.GetConnectionDetails({ id }, metadata),
).catch((err) => {
throw new HttpException(
err.details,