mirror of
https://github.com/dadosfera/maestro.git
synced 2026-10-16 00:29:09 +00:00
Merge Input Refactor
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
} from '@nestjs/microservices';
|
||||
import { NetworkConfig } from '@dadosfera/protospack-v2';
|
||||
|
||||
export class NetworkConfigClientConfiguration {
|
||||
export class NetworkConfigGrpcClient {
|
||||
private config: GrpcOptions = {
|
||||
transport: Transport.GRPC,
|
||||
options: {
|
||||
@@ -15,9 +15,8 @@ export class NetworkConfigClientConfiguration {
|
||||
NetworkConfig.ProtoPackages.ReadPackage,
|
||||
NetworkConfig.ProtoPackages.WritePackage,
|
||||
],
|
||||
credentials: undefined,
|
||||
// credentials:
|
||||
// process.env.ENV === 'local' ? undefined : credentials.createSsl(),
|
||||
credentials:
|
||||
process.env.ENV === 'local' ? undefined : credentials.createSsl(),
|
||||
protoPath: [
|
||||
NetworkConfig.ProtoPaths.ReadFilePath,
|
||||
NetworkConfig.ProtoPaths.WriteFilePath,
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import { ClientsModule } from '@nestjs/microservices';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { NetworkConfigClientConfiguration } from './network-config-client.config';
|
||||
import { NetworkConfigController } from './network-config.controller';
|
||||
import { NetworkConfigService } from './network-config.service';
|
||||
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
||||
|
||||
describe('NetworkConfigController', () => {
|
||||
let controller: NetworkConfigController;
|
||||
|
||||
beforeEach(async () => {
|
||||
const client = new NetworkConfigClientConfiguration();
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [NetworkConfigController],
|
||||
providers: [NetworkConfigService, DadosferaLogger],
|
||||
imports: [ClientsModule.register([client.providerOptions])],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<NetworkConfigController>(NetworkConfigController);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(controller).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -3,8 +3,8 @@ import { NetworkConfigController } from './network-config.controller';
|
||||
import { NetworkConfigService } from './network-config.service';
|
||||
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
||||
import { ClientsModule } from '@nestjs/microservices';
|
||||
import { NetworkConfigClientConfiguration } from './network-config-client.config';
|
||||
const client = new NetworkConfigClientConfiguration();
|
||||
import { NetworkConfigGrpcClient } from './network-config-client.config';
|
||||
const client = new NetworkConfigGrpcClient();
|
||||
|
||||
@Module({
|
||||
controllers: [NetworkConfigController],
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
import { ClientsModule } from '@nestjs/microservices';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { NetworkConfigClientConfiguration } from './network-config-client.config';
|
||||
import { NetworkConfigController } from './network-config.controller';
|
||||
import { NetworkConfigService } from './network-config.service';
|
||||
import { DadosferaLogger } from '@dadosfera/dadosfera-logs';
|
||||
|
||||
describe('NetworkConfigService', () => {
|
||||
let service: NetworkConfigService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const client = new NetworkConfigClientConfiguration();
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [NetworkConfigController],
|
||||
providers: [NetworkConfigService, DadosferaLogger],
|
||||
imports: [ClientsModule.register([client.providerOptions])],
|
||||
}).compile();
|
||||
|
||||
service = module.get<NetworkConfigService>(NetworkConfigService);
|
||||
});
|
||||
|
||||
it('should be defined', () => {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -91,7 +91,11 @@ export class NetworkConfigService {
|
||||
file: Express.Multer.File,
|
||||
{ customer_name, customer_id },
|
||||
): Promise<CreateNetworkConfigRes> {
|
||||
const { description, name, type, network_type_id, plugin } = body;
|
||||
const { description, name, network_type_id } = body;
|
||||
let { type, plugin } = body;
|
||||
|
||||
type = type || 'vpn';
|
||||
plugin = plugin || 'openvpn';
|
||||
|
||||
const OVPN_FILE_STRING = Buffer.from(file.buffer).toString();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user