FIX: Create VPN using multipart form data to fetch file

This commit is contained in:
Gabriel Rosa
2022-08-03 16:30:32 -03:00
parent 2514245a44
commit cbee264182
4 changed files with 29 additions and 7 deletions
@@ -88,9 +88,13 @@ export class NetworkConfigService {
async createNetworkConfig(
body: CreateNetworkConfigReq,
file: Express.Multer.File,
{ customer_name, customer_id },
): Promise<CreateNetworkConfigRes> {
const { description, name, properties, type, network_type_id } = body;
const { description, name, type, network_type_id, plugin } = body;
const OVPN_FILE_STRING = Buffer.from(file.buffer).toString();
const meta = new Metadata();
meta.add('customer_id', customer_id);
meta.add('customer_name', customer_name);
@@ -100,7 +104,10 @@ export class NetworkConfigService {
customer_name,
description,
name,
properties: JSON.stringify(properties),
properties: JSON.stringify({
OVPN_FILE: OVPN_FILE_STRING,
plugin,
}),
type,
network_type_id,
},