From c7f4dcab5cf19db76239ce6a0dcc4f0b8c963370 Mon Sep 17 00:00:00 2001 From: Ryan Graham Date: Wed, 3 Jun 2020 09:02:15 -0400 Subject: [PATCH] cleanup + lint --- app/apollo/resolvers/channel.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/app/apollo/resolvers/channel.js b/app/apollo/resolvers/channel.js index 053680359..a2522f598 100644 --- a/app/apollo/resolvers/channel.js +++ b/app/apollo/resolvers/channel.js @@ -178,7 +178,7 @@ const channelResolvers = { throw 'channel_uuid not specified'; } if(!file && !content){ - throw `Please specify either file or content`; + throw 'Please specify either file or content'; } const channel = await models.Channel.findOne({ uuid: channel_uuid, org_id }); @@ -195,7 +195,6 @@ const channelResolvers = { throw new ValidationError(`The version name ${name} already exists`); } - //console.log(33333, file); let fileStream = null; if(file){ fileStream = (await file).createReadStream(); @@ -203,7 +202,6 @@ const channelResolvers = { else{ fileStream = stream.Readable.from([ content ]); } - console.log(33334); const iv = crypto.randomBytes(16); const ivText = iv.toString('base64'); @@ -227,22 +225,22 @@ const channelResolvers = { } else{ var buf = new WritableStreamBuffer(); - await stream.pipeline( - fileStream, - buf, - (err)=>{ - if(err){ + await new Promise((resolve, reject)=>{ + return stream.pipeline( + fileStream, + buf, + (err)=>{ + if(err){ + reject(err); + } resolve(err); } - } - ); + ); + }); const content = buf.getContents().toString('utf8'); data = await encryptOrgData(orgKey, content); } - console.log(1111, data); - //return; - const deployableVersionObj = { _id: UUID(), org_id,