Built motion from commit ab065936.|2.0.50
[motion2.git] / server / api / voiceRecording / voiceRecording.controller.js
index f8f5abd..646c234 100644 (file)
@@ -1 +1 @@
-var _0x4cbc=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x61\x73\x74\x2D\x6A\x73\x6F\x6E\x2D\x70\x61\x74\x63\x68","\x72\x65\x71\x75\x65\x73\x74\x2D\x70\x72\x6F\x6D\x69\x73\x65","\x6D\x6F\x6D\x65\x6E\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6D\x75\x73\x74\x61\x63\x68\x65","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x73\x6F\x78","\x74\x6F\x2D\x63\x73\x76","\x65\x6A\x73","\x66\x73","\x6C\x6F\x64\x61\x73\x68","\x73\x71\x75\x65\x6C","\x63\x72\x79\x70\x74\x6F","\x6A\x73\x66\x6F\x72\x63\x65","\x64\x65\x73\x6B\x2E\x6A\x73","\x71\x75\x65\x72\x79\x73\x74\x72\x69\x6E\x67","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73\x2F\x70\x61\x72\x73\x65\x72\x73\x2F\x71\x73","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x64\x62","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x79\x73\x71\x6C\x64\x62","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x2C\x20\x25\x73\x2C\x20\x25\x73\x2C\x20\x25\x73","\x6E\x6F\x20\x63\x6F\x6E\x74\x65\x6E\x74","\x69\x6E\x66\x6F","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x2C\x20\x25\x73\x2C\x20\x25\x73\x2C\x20\x25\x73\x2C\x20\x25\x73","\x64\x65\x62\x75\x67","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x65\x6E\x74\x69\x74\x79\x20\x66\x6F\x75\x6E\x64","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x6A\x73\x6F\x6E","\x63\x6F\x75\x6E\x74","\x6F\x66\x66\x73\x65\x74","\x6C\x69\x6D\x69\x74","\x65\x6E\x74\x69\x74\x69\x65\x73\x20\x66\x6F\x75\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x52\x61\x6E\x67\x65","\x2D","\x2F","\x73\x65\x74","\x61\x70\x70\x6C\x79","\x72\x65\x6A\x65\x63\x74","\x73\x61\x76\x65","\x65\x6E\x74\x69\x74\x79\x20\x75\x70\x64\x61\x74\x65\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65","\x65\x6E\x74\x69\x74\x79\x20\x72\x65\x6D\x6F\x76\x65\x64","\x64\x65\x73\x74\x72\x6F\x79","\x65\x6E\x74\x69\x74\x79\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x65\x72\x72\x6F\x72","\x69\x6E\x73\x70\x65\x63\x74","\x6E\x61\x6D\x65","\x73\x65\x6E\x64","\x69\x6E\x64\x65\x78","\x6D\x6F\x64\x65\x6C","\x72\x61\x77\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67","\x6B\x65\x79\x73","\x66\x6F\x72\x6D\x61\x74","\x64\x69\x66\x66\x65\x72\x65\x6E\x63\x65\x42\x79","\x64\x61\x74\x65\x53\x74\x61\x72\x74","\x71\x75\x65\x72\x79","\x64\x61\x74\x65\x45\x6E\x64","\x66\x69\x6C\x74\x65\x72\x73","\x69\x6E\x74\x65\x72\x73\x65\x63\x74\x69\x6F\x6E","\x61\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x66\x69\x65\x6C\x64\x73","\x6C\x65\x6E\x67\x74\x68","\x6E\x6F\x6C\x69\x6D\x69\x74","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x6F\x72\x64\x65\x72","\x73\x6F\x72\x74","\x77\x68\x65\x72\x65","\x70\x69\x63\x6B","\x64\x61\x79","\x61\x64\x64","\x6D\x65\x72\x67\x65","\x66\x69\x6C\x74\x65\x72","\x25","\x6D\x61\x70","\x6F\x70\x74\x69\x6F\x6E\x73","\x63\x61\x74\x63\x68","\x72\x6F\x77\x73","\x69\x6E\x63\x6C\x75\x64\x65\x41\x6C\x6C","\x69\x6E\x63\x6C\x75\x64\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x64\x65\x73\x63\x72\x69\x62\x65","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x74\x79\x70\x65","\x75\x6E\x69\x71\x75\x65\x69\x64","\x2E\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x2C\x20\x25\x73\x2C\x20\x25\x73","\x76\x61\x6C\x75\x65","\x65\x78\x69\x73\x74\x73\x53\x79\x6E\x63","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x53\x65\x71\x75\x65\x6C\x69\x7A\x65","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x65\x78\x74\x6E\x61\x6D\x65"];_0x4cbc[0];var jsonpatch=require(_0x4cbc[1]);var rp=require(_0x4cbc[2]);var moment=require(_0x4cbc[3]);var BPromise=require(_0x4cbc[4]);var Mustache=require(_0x4cbc[5]);var util=require(_0x4cbc[6]);var path=require(_0x4cbc[7]);var sox=require(_0x4cbc[8]);var csv=require(_0x4cbc[9]);var ejs=require(_0x4cbc[10]);var fs=require(_0x4cbc[11]);var _=require(_0x4cbc[12]);var squel=require(_0x4cbc[13]);var crypto=require(_0x4cbc[14]);var jsforce=require(_0x4cbc[15]);var deskjs=require(_0x4cbc[16]);var toCsv=require(_0x4cbc[9]);var querystring=require(_0x4cbc[17]);var qs=require(_0x4cbc[18]);var logger=require(_0x4cbc[20])(_0x4cbc[19]);var utils=require(_0x4cbc[21]);var config=require(_0x4cbc[22]);var db=require(_0x4cbc[24])[_0x4cbc[23]];function respondWithStatusCode(_0x1e5ax19,_0x1e5ax1a,_0x1e5ax1b){_0x1e5ax1a= _0x1e5ax1a|| 204;return function(_0x1e5ax1c){if(_0x1e5ax1c){logger[_0x4cbc[27]](_0x4cbc[25],_0x1e5ax1b,_0x1e5ax1a,_0x4cbc[26]);logger[_0x4cbc[29]](_0x4cbc[28],_0x1e5ax1b,_0x1e5ax1a,_0x4cbc[26]);return _0x1e5ax19[_0x4cbc[30]](_0x1e5ax1a)};return _0x1e5ax19[_0x4cbc[32]](_0x1e5ax1a)[_0x4cbc[31]]()}}function respondWithResult(_0x1e5ax19,_0x1e5ax1a,_0x1e5ax1b){_0x1e5ax1a= _0x1e5ax1a|| 200;return function(_0x1e5ax1c){if(_0x1e5ax1c){logger[_0x4cbc[27]](_0x4cbc[25],_0x1e5ax1b,_0x1e5ax1a,_0x4cbc[33]);logger[_0x4cbc[29]](_0x4cbc[28],_0x1e5ax1b,_0x1e5ax1a,_0x4cbc[33],JSON[_0x4cbc[34]](_0x1e5ax1c));return _0x1e5ax19[_0x4cbc[32]](_0x1e5ax1a)[_0x4cbc[35]](_0x1e5ax1c)}}}function respondWithFilteredResult(_0x1e5ax19,_0x1e5ax1f,_0x1e5ax1b){return function(_0x1e5ax1c){if(_0x1e5ax1c){var _0x1e5ax20=_0x1e5ax1c[_0x4cbc[36]],_0x1e5ax21=_0x1e5ax1f[_0x4cbc[37]],_0x1e5ax22=_0x1e5ax1f[_0x4cbc[37]]+ _0x1e5ax1f[_0x4cbc[38]],_0x1e5ax1a;if(_0x1e5ax22>= _0x1e5ax20){_0x1e5ax22= _0x1e5ax20;_0x1e5ax1a= 200}else {_0x1e5ax1a= 206};_0x1e5ax19[_0x4cbc[32]](_0x1e5ax1a);logger[_0x4cbc[27]](_0x4cbc[25],_0x1e5ax1b,_0x1e5ax1a,_0x4cbc[39]);logger[_0x4cbc[29]](_0x4cbc[28],_0x1e5ax1b,_0x1e5ax1a,_0x4cbc[33],JSON[_0x4cbc[34]](_0x1e5ax1c));return _0x1e5ax19[_0x4cbc[43]](_0x4cbc[40],_0x1e5ax21+ _0x4cbc[41]+ _0x1e5ax22+ _0x4cbc[42]+ _0x1e5ax20)[_0x4cbc[35]](_0x1e5ax1c)};return null}}function patchUpdates(_0x1e5ax24){return function(_0x1e5ax1c){try{jsonpatch[_0x4cbc[44]](_0x1e5ax1c,_0x1e5ax24,true)}catch(err){return BPromise[_0x4cbc[45]](err)};return _0x1e5ax1c[_0x4cbc[46]]()}}function saveUpdates(_0x1e5ax26,_0x1e5ax1a,_0x1e5ax1b){return function(_0x1e5ax1c){if(_0x1e5ax1c){return _0x1e5ax1c[_0x4cbc[49]](_0x1e5ax26)[_0x4cbc[48]](function(_0x1e5ax27){logger[_0x4cbc[27]](_0x4cbc[25],_0x1e5ax1b,_0x1e5ax1a,_0x4cbc[47]);logger[_0x4cbc[29]](_0x4cbc[28],_0x1e5ax1b,_0x1e5ax1a,_0x4cbc[47],JSON[_0x4cbc[34]](_0x1e5ax1c));return _0x1e5ax27})};return null}}function removeEntity(_0x1e5ax19,_0x1e5ax1a,_0x1e5ax1b){return function(_0x1e5ax1c){if(_0x1e5ax1c){return _0x1e5ax1c[_0x4cbc[51]]()[_0x4cbc[48]](function(){logger[_0x4cbc[27]](_0x4cbc[25],_0x1e5ax1b,_0x1e5ax1a,_0x4cbc[50]);logger[_0x4cbc[29]](_0x4cbc[28],_0x1e5ax1b,_0x1e5ax1a,_0x4cbc[50],JSON[_0x4cbc[34]](_0x1e5ax1c));_0x1e5ax19[_0x4cbc[32]](204)[_0x4cbc[31]]()})}}}function handleEntityNotFound(_0x1e5ax19,_0x1e5ax1a,_0x1e5ax1b){return function(_0x1e5ax1c){if(!_0x1e5ax1c){logger[_0x4cbc[53]](_0x4cbc[25],_0x1e5ax1b,404,_0x4cbc[52]);_0x1e5ax19[_0x4cbc[30]](404)};return _0x1e5ax1c}}function handleError(_0x1e5ax19,_0x1e5ax1a,_0x1e5ax1b){_0x1e5ax1a= _0x1e5ax1a|| 500;return function(_0x1e5ax2b){logger[_0x4cbc[53]](_0x4cbc[25],_0x1e5ax1b,_0x1e5ax1a,util[_0x4cbc[54]](_0x1e5ax2b,{showHidden:false,depth:null}));delete _0x1e5ax2b[_0x4cbc[55]];_0x1e5ax19[_0x4cbc[32]](_0x1e5ax1a)[_0x4cbc[56]](_0x1e5ax2b)}}exports[_0x4cbc[57]]= function(_0x1e5ax2c,_0x1e5ax19){var _0x1e5ax1f={},_0x1e5ax2d={},_0x1e5ax2e={count:0,rows:[]};_0x1e5ax2d[_0x4cbc[58]]= _[_0x4cbc[63]](_[_0x4cbc[61]](db[_0x4cbc[60]][_0x4cbc[59]]),[_0x4cbc[62]]);var _0x1e5ax2f={dateStart:_0x1e5ax2c[_0x4cbc[65]][_0x4cbc[64]],dateEnd:_0x1e5ax2c[_0x4cbc[65]][_0x4cbc[66]]};delete _0x1e5ax2c[_0x4cbc[65]][_0x4cbc[64]];delete _0x1e5ax2c[_0x4cbc[65]][_0x4cbc[66]];_0x1e5ax2d[_0x4cbc[65]]= _[_0x4cbc[61]](_0x1e5ax2c[_0x4cbc[65]]);_0x1e5ax2d[_0x4cbc[67]]= _[_0x4cbc[68]](_0x1e5ax2d[_0x4cbc[58]],_0x1e5ax2d[_0x4cbc[65]]);_0x1e5ax1f[_0x4cbc[69]]= _[_0x4cbc[68]](_0x1e5ax2d[_0x4cbc[58]],qs[_0x4cbc[70]](_0x1e5ax2c[_0x4cbc[65]][_0x4cbc[70]]));_0x1e5ax1f[_0x4cbc[69]]= (_0x1e5ax1f[_0x4cbc[69]][_0x4cbc[71]])?_0x1e5ax1f[_0x4cbc[69]]:_0x1e5ax2d[_0x4cbc[58]];if(!_0x1e5ax2c[_0x4cbc[65]][_0x4cbc[73]](_0x4cbc[72])){_0x1e5ax1f[_0x4cbc[38]]= qs[_0x4cbc[38]](_0x1e5ax2c[_0x4cbc[65]][_0x4cbc[38]]);_0x1e5ax1f[_0x4cbc[37]]= qs[_0x4cbc[37]](_0x1e5ax2c[_0x4cbc[65]][_0x4cbc[37]])};_0x1e5ax1f[_0x4cbc[74]]= qs[_0x4cbc[75]](_0x1e5ax2c[_0x4cbc[65]][_0x4cbc[75]]);_0x1e5ax1f[_0x4cbc[76]]= qs[_0x4cbc[67]](_[_0x4cbc[77]](_0x1e5ax2c[_0x4cbc[65]],_0x1e5ax2d[_0x4cbc[67]]));if(_0x1e5ax2f[_0x4cbc[64]]){if(_0x1e5ax2f[_0x4cbc[66]]){_0x1e5ax2f[_0x4cbc[66]]= moment(_0x1e5ax2f[_0x4cbc[66]])[_0x4cbc[79]](1,_0x4cbc[78])}else {_0x1e5ax2f[_0x4cbc[66]]= moment(_0x1e5ax2f[_0x4cbc[64]])[_0x4cbc[79]](1,_0x4cbc[78])};_[_0x4cbc[80]](_0x1e5ax1f[_0x4cbc[76]],{createdAt:{$gte:_0x1e5ax2f[_0x4cbc[64]],$lte:_0x1e5ax2f[_0x4cbc[66]]}})};if(_0x1e5ax2c[_0x4cbc[65]][_0x4cbc[81]]){_0x1e5ax1f[_0x4cbc[76]]= _[_0x4cbc[80]](_0x1e5ax1f[_0x4cbc[76]],{$or:_[_0x4cbc[83]](_0x1e5ax1f[_0x4cbc[69]],function(_0x1e5ax30){var _0x1e5ax2e={};_0x1e5ax2e[_0x1e5ax30]= {$like:_0x4cbc[82]+ _0x1e5ax2c[_0x4cbc[65]][_0x4cbc[81]]+ _0x4cbc[82]};return _0x1e5ax2e})})};_0x1e5ax1f= _[_0x4cbc[80]]({},_0x1e5ax1f,_0x1e5ax2c[_0x4cbc[84]]);return db[_0x4cbc[60]][_0x4cbc[36]]({where:_0x1e5ax1f[_0x4cbc[76]]})[_0x4cbc[48]](function(_0x1e5ax20){_0x1e5ax2e[_0x4cbc[36]]= _0x1e5ax20;if(_0x1e5ax2c[_0x4cbc[65]][_0x4cbc[87]]){_0x1e5ax1f[_0x4cbc[88]]= [{all:true}]};return db[_0x4cbc[60]][_0x4cbc[89]](_0x1e5ax1f)})[_0x4cbc[48]](function(_0x1e5ax31){_0x1e5ax2e[_0x4cbc[86]]= _0x1e5ax31;return _0x1e5ax2e})[_0x4cbc[48]](respondWithFilteredResult(_0x1e5ax19,_0x1e5ax1f,_0x4cbc[57]))[_0x4cbc[85]](handleError(_0x1e5ax19,null,_0x4cbc[57]))};exports[_0x4cbc[90]]= function(_0x1e5ax2c,_0x1e5ax19){var _0x1e5ax1f={raw:false,where:{id:_0x1e5ax2c[_0x4cbc[92]][_0x4cbc[91]]}},_0x1e5ax2d={};_0x1e5ax2d[_0x4cbc[58]]= _[_0x4cbc[61]](db[_0x4cbc[60]][_0x4cbc[59]]);_0x1e5ax2d[_0x4cbc[65]]= _[_0x4cbc[61]](_0x1e5ax2c[_0x4cbc[65]]);_0x1e5ax2d[_0x4cbc[67]]= _[_0x4cbc[68]](_0x1e5ax2d[_0x4cbc[58]],_0x1e5ax2d[_0x4cbc[65]]);_0x1e5ax1f[_0x4cbc[69]]= _[_0x4cbc[68]](_0x1e5ax2d[_0x4cbc[58]],qs[_0x4cbc[70]](_0x1e5ax2c[_0x4cbc[65]][_0x4cbc[70]]));_0x1e5ax1f[_0x4cbc[69]]= (_0x1e5ax1f[_0x4cbc[69]][_0x4cbc[71]])?_0x1e5ax1f[_0x4cbc[69]]:_0x1e5ax2d[_0x4cbc[58]];if(_0x1e5ax2c[_0x4cbc[65]][_0x4cbc[87]]){_0x1e5ax1f[_0x4cbc[88]]= [{all:true}]};_0x1e5ax1f= _[_0x4cbc[80]]({},_0x1e5ax1f,_0x1e5ax2c[_0x4cbc[84]]);return db[_0x4cbc[60]][_0x4cbc[93]](_0x1e5ax1f)[_0x4cbc[48]](handleEntityNotFound(_0x1e5ax19,null,_0x4cbc[90]))[_0x4cbc[48]](respondWithResult(_0x1e5ax19,null,_0x4cbc[90]))[_0x4cbc[85]](handleError(_0x1e5ax19,null,_0x4cbc[90]))};exports[_0x4cbc[94]]= function(_0x1e5ax2c,_0x1e5ax19){return db[_0x4cbc[60]][_0x4cbc[94]](_0x1e5ax2c[_0x4cbc[95]],{})[_0x4cbc[48]](respondWithResult(_0x1e5ax19,201,_0x4cbc[94]))[_0x4cbc[85]](handleError(_0x1e5ax19,null,_0x4cbc[94]))};exports[_0x4cbc[49]]= function(_0x1e5ax2c,_0x1e5ax19){if(_0x1e5ax2c[_0x4cbc[95]][_0x4cbc[91]]){delete _0x1e5ax2c[_0x4cbc[95]][_0x4cbc[91]]};return db[_0x4cbc[60]][_0x4cbc[93]]({where:{id:_0x1e5ax2c[_0x4cbc[92]][_0x4cbc[91]]}})[_0x4cbc[48]](handleEntityNotFound(_0x1e5ax19,null,_0x4cbc[49]))[_0x4cbc[48]](saveUpdates(_0x1e5ax2c[_0x4cbc[95]],null,_0x4cbc[49]))[_0x4cbc[48]](respondWithResult(_0x1e5ax19,null,_0x4cbc[49]))[_0x4cbc[85]](handleError(_0x1e5ax19,null,_0x4cbc[49]))};exports[_0x4cbc[51]]= function(_0x1e5ax2c,_0x1e5ax19){return db[_0x4cbc[60]][_0x4cbc[93]]({where:{id:_0x1e5ax2c[_0x4cbc[92]][_0x4cbc[91]]}})[_0x4cbc[48]](handleEntityNotFound(_0x1e5ax19,null,_0x4cbc[51]))[_0x4cbc[48]](removeEntity(_0x1e5ax19,null,_0x4cbc[51]))[_0x4cbc[85]](handleError(_0x1e5ax19,null,_0x4cbc[51]))};exports[_0x4cbc[96]]= function(_0x1e5ax2c,_0x1e5ax19){return db[_0x4cbc[60]][_0x4cbc[96]]()[_0x4cbc[48]](respondWithResult(_0x1e5ax19,null,_0x4cbc[96]))[_0x4cbc[85]](handleError(_0x1e5ax19,null,_0x4cbc[96]))};exports[_0x4cbc[97]]= function(_0x1e5ax2c,_0x1e5ax19,_0x1e5ax32){var _0x1e5ax33={};if(_0x1e5ax2c[_0x4cbc[65]][_0x4cbc[98]]&& _0x1e5ax2c[_0x4cbc[65]][_0x4cbc[98]]=== _0x4cbc[99]){_0x1e5ax33[_0x4cbc[99]]= _0x1e5ax2c[_0x4cbc[92]][_0x4cbc[91]]}else {_0x1e5ax33[_0x4cbc[91]]= _0x1e5ax2c[_0x4cbc[92]][_0x4cbc[91]]};return db[_0x4cbc[60]][_0x4cbc[93]]({where:_0x1e5ax33,attributes:[_0x4cbc[91],_0x4cbc[102]],raw:true})[_0x4cbc[48]](handleEntityNotFound(_0x1e5ax19,null,_0x4cbc[97]))[_0x4cbc[48]](function(_0x1e5ax1c){if(_0x1e5ax1c){logger[_0x4cbc[27]](_0x4cbc[101],_0x4cbc[97],_0x4cbc[33]);logger[_0x4cbc[29]](_0x4cbc[25],_0x4cbc[97],_0x4cbc[33],JSON[_0x4cbc[34]](_0x1e5ax1c));if(!fs[_0x4cbc[103]](_0x1e5ax1c[_0x4cbc[102]])){throw  new db[_0x4cbc[105]].ValidationError(_0x4cbc[104])};if(_0x1e5ax1c[_0x4cbc[106]]){return _0x1e5ax19[_0x4cbc[97]](_0x1e5ax1c[_0x4cbc[102]],_0x1e5ax1c[_0x4cbc[106]]+ path[_0x4cbc[107]](_0x1e5ax1c[_0x4cbc[102]]))}else {return _0x1e5ax19[_0x4cbc[97]](_0x1e5ax1c[_0x4cbc[102]])}}})[_0x4cbc[85]](handleError(_0x1e5ax19,null,_0x4cbc[100]))}
\ No newline at end of file
+var _0xae0c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x66\x61\x73\x74\x2D\x6A\x73\x6F\x6E\x2D\x70\x61\x74\x63\x68","\x72\x65\x71\x75\x65\x73\x74\x2D\x70\x72\x6F\x6D\x69\x73\x65","\x6D\x6F\x6D\x65\x6E\x74","\x62\x6C\x75\x65\x62\x69\x72\x64","\x6D\x75\x73\x74\x61\x63\x68\x65","\x75\x74\x69\x6C","\x70\x61\x74\x68","\x73\x6F\x78","\x74\x6F\x2D\x63\x73\x76","\x65\x6A\x73","\x66\x73","\x6C\x6F\x64\x61\x73\x68","\x73\x71\x75\x65\x6C","\x63\x72\x79\x70\x74\x6F","\x6A\x73\x66\x6F\x72\x63\x65","\x64\x65\x73\x6B\x2E\x6A\x73","\x71\x75\x65\x72\x79\x73\x74\x72\x69\x6E\x67","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6D\x70\x6F\x6E\x65\x6E\x74\x73\x2F\x70\x61\x72\x73\x65\x72\x73\x2F\x71\x73","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x64\x62","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x79\x73\x71\x6C\x64\x62","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x2C\x20\x25\x73\x2C\x20\x25\x73\x2C\x20\x25\x73","\x6E\x6F\x20\x63\x6F\x6E\x74\x65\x6E\x74","\x69\x6E\x66\x6F","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x2C\x20\x25\x73\x2C\x20\x25\x73\x2C\x20\x25\x73\x2C\x20\x25\x73","\x64\x65\x62\x75\x67","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x65\x6E\x74\x69\x74\x79\x20\x66\x6F\x75\x6E\x64","\x73\x74\x72\x69\x6E\x67\x69\x66\x79","\x6A\x73\x6F\x6E","\x63\x6F\x75\x6E\x74","\x6F\x66\x66\x73\x65\x74","\x6C\x69\x6D\x69\x74","\x65\x6E\x74\x69\x74\x69\x65\x73\x20\x66\x6F\x75\x6E\x64","\x43\x6F\x6E\x74\x65\x6E\x74\x2D\x52\x61\x6E\x67\x65","\x2D","\x2F","\x73\x65\x74","\x61\x70\x70\x6C\x79","\x72\x65\x6A\x65\x63\x74","\x73\x61\x76\x65","\x65\x6E\x74\x69\x74\x79\x20\x75\x70\x64\x61\x74\x65\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65","\x65\x6E\x74\x69\x74\x79\x20\x72\x65\x6D\x6F\x76\x65\x64","\x64\x65\x73\x74\x72\x6F\x79","\x65\x6E\x74\x69\x74\x79\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x65\x72\x72\x6F\x72","\x69\x6E\x73\x70\x65\x63\x74","\x6E\x61\x6D\x65","\x73\x65\x6E\x64","\x69\x6E\x64\x65\x78","\x6D\x6F\x64\x65\x6C","\x72\x61\x77\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67","\x6B\x65\x79\x73","\x66\x6F\x72\x6D\x61\x74","\x64\x69\x66\x66\x65\x72\x65\x6E\x63\x65\x42\x79","\x64\x61\x74\x65\x53\x74\x61\x72\x74","\x71\x75\x65\x72\x79","\x64\x61\x74\x65\x45\x6E\x64","\x66\x69\x6C\x74\x65\x72\x73","\x69\x6E\x74\x65\x72\x73\x65\x63\x74\x69\x6F\x6E","\x61\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x66\x69\x65\x6C\x64\x73","\x6C\x65\x6E\x67\x74\x68","\x6E\x6F\x6C\x69\x6D\x69\x74","\x68\x61\x73\x4F\x77\x6E\x50\x72\x6F\x70\x65\x72\x74\x79","\x6F\x72\x64\x65\x72","\x73\x6F\x72\x74","\x77\x68\x65\x72\x65","\x70\x69\x63\x6B","\x64\x61\x79","\x61\x64\x64","\x6D\x65\x72\x67\x65","\x66\x69\x6C\x74\x65\x72","\x25","\x6D\x61\x70","\x6F\x70\x74\x69\x6F\x6E\x73","\x63\x61\x74\x63\x68","\x72\x6F\x77\x73","\x69\x6E\x63\x6C\x75\x64\x65\x41\x6C\x6C","\x69\x6E\x63\x6C\x75\x64\x65","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64","\x63\x72\x65\x61\x74\x65","\x62\x6F\x64\x79","\x64\x65\x73\x63\x72\x69\x62\x65","\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x74\x79\x70\x65","\x75\x6E\x69\x71\x75\x65\x69\x64","\x2E\x64\x6F\x77\x6E\x6C\x6F\x61\x64","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x2C\x20\x25\x73\x2C\x20\x25\x73","\x76\x61\x6C\x75\x65","\x65\x78\x69\x73\x74\x73\x53\x79\x6E\x63","\x56\x6F\x69\x63\x65\x52\x65\x63\x6F\x72\x64\x69\x6E\x67\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x53\x65\x71\x75\x65\x6C\x69\x7A\x65","\x66\x69\x6C\x65\x6E\x61\x6D\x65","\x65\x78\x74\x6E\x61\x6D\x65"];_0xae0c[0];var jsonpatch=require(_0xae0c[1]);var rp=require(_0xae0c[2]);var moment=require(_0xae0c[3]);var BPromise=require(_0xae0c[4]);var Mustache=require(_0xae0c[5]);var util=require(_0xae0c[6]);var path=require(_0xae0c[7]);var sox=require(_0xae0c[8]);var csv=require(_0xae0c[9]);var ejs=require(_0xae0c[10]);var fs=require(_0xae0c[11]);var _=require(_0xae0c[12]);var squel=require(_0xae0c[13]);var crypto=require(_0xae0c[14]);var jsforce=require(_0xae0c[15]);var deskjs=require(_0xae0c[16]);var toCsv=require(_0xae0c[9]);var querystring=require(_0xae0c[17]);var qs=require(_0xae0c[18]);var logger=require(_0xae0c[20])(_0xae0c[19]);var utils=require(_0xae0c[21]);var config=require(_0xae0c[22]);var db=require(_0xae0c[24])[_0xae0c[23]];function respondWithStatusCode(_0x53cdx19,_0x53cdx1a,_0x53cdx1b){_0x53cdx1a= _0x53cdx1a|| 204;return function(_0x53cdx1c){if(_0x53cdx1c){logger[_0xae0c[27]](_0xae0c[25],_0x53cdx1b,_0x53cdx1a,_0xae0c[26]);logger[_0xae0c[29]](_0xae0c[28],_0x53cdx1b,_0x53cdx1a,_0xae0c[26]);return _0x53cdx19[_0xae0c[30]](_0x53cdx1a)};return _0x53cdx19[_0xae0c[32]](_0x53cdx1a)[_0xae0c[31]]()}}function respondWithResult(_0x53cdx19,_0x53cdx1a,_0x53cdx1b){_0x53cdx1a= _0x53cdx1a|| 200;return function(_0x53cdx1c){if(_0x53cdx1c){logger[_0xae0c[27]](_0xae0c[25],_0x53cdx1b,_0x53cdx1a,_0xae0c[33]);logger[_0xae0c[29]](_0xae0c[28],_0x53cdx1b,_0x53cdx1a,_0xae0c[33],JSON[_0xae0c[34]](_0x53cdx1c));return _0x53cdx19[_0xae0c[32]](_0x53cdx1a)[_0xae0c[35]](_0x53cdx1c)}}}function respondWithFilteredResult(_0x53cdx19,_0x53cdx1f,_0x53cdx1b){return function(_0x53cdx1c){if(_0x53cdx1c){var _0x53cdx20=_0x53cdx1c[_0xae0c[36]],_0x53cdx21=_0x53cdx1f[_0xae0c[37]],_0x53cdx22=_0x53cdx1f[_0xae0c[37]]+ _0x53cdx1f[_0xae0c[38]],_0x53cdx1a;if(_0x53cdx22>= _0x53cdx20){_0x53cdx22= _0x53cdx20;_0x53cdx1a= 200}else {_0x53cdx1a= 206};_0x53cdx19[_0xae0c[32]](_0x53cdx1a);logger[_0xae0c[27]](_0xae0c[25],_0x53cdx1b,_0x53cdx1a,_0xae0c[39]);logger[_0xae0c[29]](_0xae0c[28],_0x53cdx1b,_0x53cdx1a,_0xae0c[33],JSON[_0xae0c[34]](_0x53cdx1c));return _0x53cdx19[_0xae0c[43]](_0xae0c[40],_0x53cdx21+ _0xae0c[41]+ _0x53cdx22+ _0xae0c[42]+ _0x53cdx20)[_0xae0c[35]](_0x53cdx1c)};return null}}function patchUpdates(_0x53cdx24){return function(_0x53cdx1c){try{jsonpatch[_0xae0c[44]](_0x53cdx1c,_0x53cdx24,true)}catch(err){return BPromise[_0xae0c[45]](err)};return _0x53cdx1c[_0xae0c[46]]()}}function saveUpdates(_0x53cdx26,_0x53cdx1a,_0x53cdx1b){return function(_0x53cdx1c){if(_0x53cdx1c){return _0x53cdx1c[_0xae0c[49]](_0x53cdx26)[_0xae0c[48]](function(_0x53cdx27){logger[_0xae0c[27]](_0xae0c[25],_0x53cdx1b,_0x53cdx1a,_0xae0c[47]);logger[_0xae0c[29]](_0xae0c[28],_0x53cdx1b,_0x53cdx1a,_0xae0c[47],JSON[_0xae0c[34]](_0x53cdx1c));return _0x53cdx27})};return null}}function removeEntity(_0x53cdx19,_0x53cdx1a,_0x53cdx1b){return function(_0x53cdx1c){if(_0x53cdx1c){return _0x53cdx1c[_0xae0c[51]]()[_0xae0c[48]](function(){logger[_0xae0c[27]](_0xae0c[25],_0x53cdx1b,_0x53cdx1a,_0xae0c[50]);logger[_0xae0c[29]](_0xae0c[28],_0x53cdx1b,_0x53cdx1a,_0xae0c[50],JSON[_0xae0c[34]](_0x53cdx1c));_0x53cdx19[_0xae0c[32]](204)[_0xae0c[31]]()})}}}function handleEntityNotFound(_0x53cdx19,_0x53cdx1a,_0x53cdx1b){return function(_0x53cdx1c){if(!_0x53cdx1c){logger[_0xae0c[53]](_0xae0c[25],_0x53cdx1b,404,_0xae0c[52]);_0x53cdx19[_0xae0c[30]](404)};return _0x53cdx1c}}function handleError(_0x53cdx19,_0x53cdx1a,_0x53cdx1b){_0x53cdx1a= _0x53cdx1a|| 500;return function(_0x53cdx2b){logger[_0xae0c[53]](_0xae0c[25],_0x53cdx1b,_0x53cdx1a,util[_0xae0c[54]](_0x53cdx2b,{showHidden:false,depth:null}));delete _0x53cdx2b[_0xae0c[55]];_0x53cdx19[_0xae0c[32]](_0x53cdx1a)[_0xae0c[56]](_0x53cdx2b)}}exports[_0xae0c[57]]= function(_0x53cdx2c,_0x53cdx19){var _0x53cdx1f={},_0x53cdx2d={},_0x53cdx2e={count:0,rows:[]};_0x53cdx2d[_0xae0c[58]]= _[_0xae0c[63]](_[_0xae0c[61]](db[_0xae0c[60]][_0xae0c[59]]),[_0xae0c[62]]);var _0x53cdx2f={dateStart:_0x53cdx2c[_0xae0c[65]][_0xae0c[64]],dateEnd:_0x53cdx2c[_0xae0c[65]][_0xae0c[66]]};delete _0x53cdx2c[_0xae0c[65]][_0xae0c[64]];delete _0x53cdx2c[_0xae0c[65]][_0xae0c[66]];_0x53cdx2d[_0xae0c[65]]= _[_0xae0c[61]](_0x53cdx2c[_0xae0c[65]]);_0x53cdx2d[_0xae0c[67]]= _[_0xae0c[68]](_0x53cdx2d[_0xae0c[58]],_0x53cdx2d[_0xae0c[65]]);_0x53cdx1f[_0xae0c[69]]= _[_0xae0c[68]](_0x53cdx2d[_0xae0c[58]],qs[_0xae0c[70]](_0x53cdx2c[_0xae0c[65]][_0xae0c[70]]));_0x53cdx1f[_0xae0c[69]]= (_0x53cdx1f[_0xae0c[69]][_0xae0c[71]])?_0x53cdx1f[_0xae0c[69]]:_0x53cdx2d[_0xae0c[58]];if(!_0x53cdx2c[_0xae0c[65]][_0xae0c[73]](_0xae0c[72])){_0x53cdx1f[_0xae0c[38]]= qs[_0xae0c[38]](_0x53cdx2c[_0xae0c[65]][_0xae0c[38]]);_0x53cdx1f[_0xae0c[37]]= qs[_0xae0c[37]](_0x53cdx2c[_0xae0c[65]][_0xae0c[37]])};_0x53cdx1f[_0xae0c[74]]= qs[_0xae0c[75]](_0x53cdx2c[_0xae0c[65]][_0xae0c[75]]);_0x53cdx1f[_0xae0c[76]]= qs[_0xae0c[67]](_[_0xae0c[77]](_0x53cdx2c[_0xae0c[65]],_0x53cdx2d[_0xae0c[67]]));if(_0x53cdx2f[_0xae0c[64]]){if(_0x53cdx2f[_0xae0c[66]]){_0x53cdx2f[_0xae0c[66]]= moment(_0x53cdx2f[_0xae0c[66]])[_0xae0c[79]](1,_0xae0c[78])}else {_0x53cdx2f[_0xae0c[66]]= moment(_0x53cdx2f[_0xae0c[64]])[_0xae0c[79]](1,_0xae0c[78])};_[_0xae0c[80]](_0x53cdx1f[_0xae0c[76]],{createdAt:{$gte:_0x53cdx2f[_0xae0c[64]],$lte:_0x53cdx2f[_0xae0c[66]]}})};if(_0x53cdx2c[_0xae0c[65]][_0xae0c[81]]){_0x53cdx1f[_0xae0c[76]]= _[_0xae0c[80]](_0x53cdx1f[_0xae0c[76]],{$or:_[_0xae0c[83]](_0x53cdx1f[_0xae0c[69]],function(_0x53cdx30){var _0x53cdx2e={};_0x53cdx2e[_0x53cdx30]= {$like:_0xae0c[82]+ _0x53cdx2c[_0xae0c[65]][_0xae0c[81]]+ _0xae0c[82]};return _0x53cdx2e})})};_0x53cdx1f= _[_0xae0c[80]]({},_0x53cdx1f,_0x53cdx2c[_0xae0c[84]]);return db[_0xae0c[60]][_0xae0c[36]]({where:_0x53cdx1f[_0xae0c[76]]})[_0xae0c[48]](function(_0x53cdx20){_0x53cdx2e[_0xae0c[36]]= _0x53cdx20;if(_0x53cdx2c[_0xae0c[65]][_0xae0c[87]]){_0x53cdx1f[_0xae0c[88]]= [{all:true}]};return db[_0xae0c[60]][_0xae0c[89]](_0x53cdx1f)})[_0xae0c[48]](function(_0x53cdx31){_0x53cdx2e[_0xae0c[86]]= _0x53cdx31;return _0x53cdx2e})[_0xae0c[48]](respondWithFilteredResult(_0x53cdx19,_0x53cdx1f,_0xae0c[57]))[_0xae0c[85]](handleError(_0x53cdx19,null,_0xae0c[57]))};exports[_0xae0c[90]]= function(_0x53cdx2c,_0x53cdx19){var _0x53cdx1f={raw:false,where:{id:_0x53cdx2c[_0xae0c[92]][_0xae0c[91]]}},_0x53cdx2d={};_0x53cdx2d[_0xae0c[58]]= _[_0xae0c[61]](db[_0xae0c[60]][_0xae0c[59]]);_0x53cdx2d[_0xae0c[65]]= _[_0xae0c[61]](_0x53cdx2c[_0xae0c[65]]);_0x53cdx2d[_0xae0c[67]]= _[_0xae0c[68]](_0x53cdx2d[_0xae0c[58]],_0x53cdx2d[_0xae0c[65]]);_0x53cdx1f[_0xae0c[69]]= _[_0xae0c[68]](_0x53cdx2d[_0xae0c[58]],qs[_0xae0c[70]](_0x53cdx2c[_0xae0c[65]][_0xae0c[70]]));_0x53cdx1f[_0xae0c[69]]= (_0x53cdx1f[_0xae0c[69]][_0xae0c[71]])?_0x53cdx1f[_0xae0c[69]]:_0x53cdx2d[_0xae0c[58]];if(_0x53cdx2c[_0xae0c[65]][_0xae0c[87]]){_0x53cdx1f[_0xae0c[88]]= [{all:true}]};_0x53cdx1f= _[_0xae0c[80]]({},_0x53cdx1f,_0x53cdx2c[_0xae0c[84]]);return db[_0xae0c[60]][_0xae0c[93]](_0x53cdx1f)[_0xae0c[48]](handleEntityNotFound(_0x53cdx19,null,_0xae0c[90]))[_0xae0c[48]](respondWithResult(_0x53cdx19,null,_0xae0c[90]))[_0xae0c[85]](handleError(_0x53cdx19,null,_0xae0c[90]))};exports[_0xae0c[94]]= function(_0x53cdx2c,_0x53cdx19){return db[_0xae0c[60]][_0xae0c[94]](_0x53cdx2c[_0xae0c[95]],{})[_0xae0c[48]](respondWithResult(_0x53cdx19,201,_0xae0c[94]))[_0xae0c[85]](handleError(_0x53cdx19,null,_0xae0c[94]))};exports[_0xae0c[49]]= function(_0x53cdx2c,_0x53cdx19){if(_0x53cdx2c[_0xae0c[95]][_0xae0c[91]]){delete _0x53cdx2c[_0xae0c[95]][_0xae0c[91]]};return db[_0xae0c[60]][_0xae0c[93]]({where:{id:_0x53cdx2c[_0xae0c[92]][_0xae0c[91]]}})[_0xae0c[48]](handleEntityNotFound(_0x53cdx19,null,_0xae0c[49]))[_0xae0c[48]](saveUpdates(_0x53cdx2c[_0xae0c[95]],null,_0xae0c[49]))[_0xae0c[48]](respondWithResult(_0x53cdx19,null,_0xae0c[49]))[_0xae0c[85]](handleError(_0x53cdx19,null,_0xae0c[49]))};exports[_0xae0c[51]]= function(_0x53cdx2c,_0x53cdx19){return db[_0xae0c[60]][_0xae0c[93]]({where:{id:_0x53cdx2c[_0xae0c[92]][_0xae0c[91]]}})[_0xae0c[48]](handleEntityNotFound(_0x53cdx19,null,_0xae0c[51]))[_0xae0c[48]](removeEntity(_0x53cdx19,null,_0xae0c[51]))[_0xae0c[85]](handleError(_0x53cdx19,null,_0xae0c[51]))};exports[_0xae0c[96]]= function(_0x53cdx2c,_0x53cdx19){return db[_0xae0c[60]][_0xae0c[96]]()[_0xae0c[48]](respondWithResult(_0x53cdx19,null,_0xae0c[96]))[_0xae0c[85]](handleError(_0x53cdx19,null,_0xae0c[96]))};exports[_0xae0c[97]]= function(_0x53cdx2c,_0x53cdx19,_0x53cdx32){var _0x53cdx33={};if(_0x53cdx2c[_0xae0c[65]][_0xae0c[98]]&& _0x53cdx2c[_0xae0c[65]][_0xae0c[98]]=== _0xae0c[99]){_0x53cdx33[_0xae0c[99]]= _0x53cdx2c[_0xae0c[92]][_0xae0c[91]]}else {_0x53cdx33[_0xae0c[91]]= _0x53cdx2c[_0xae0c[92]][_0xae0c[91]]};return db[_0xae0c[60]][_0xae0c[93]]({where:_0x53cdx33,attributes:[_0xae0c[91],_0xae0c[102]],raw:true})[_0xae0c[48]](handleEntityNotFound(_0x53cdx19,null,_0xae0c[97]))[_0xae0c[48]](function(_0x53cdx1c){if(_0x53cdx1c){logger[_0xae0c[27]](_0xae0c[101],_0xae0c[97],_0xae0c[33]);logger[_0xae0c[29]](_0xae0c[25],_0xae0c[97],_0xae0c[33],JSON[_0xae0c[34]](_0x53cdx1c));if(!fs[_0xae0c[103]](_0x53cdx1c[_0xae0c[102]])){throw  new db[_0xae0c[105]].ValidationError(_0xae0c[104])};if(_0x53cdx1c[_0xae0c[106]]){return _0x53cdx19[_0xae0c[97]](_0x53cdx1c[_0xae0c[102]],_0x53cdx1c[_0xae0c[106]]+ path[_0xae0c[107]](_0x53cdx1c[_0xae0c[102]]))}else {return _0x53cdx19[_0xae0c[97]](_0x53cdx1c[_0xae0c[102]])}}})[_0xae0c[85]](handleError(_0x53cdx19,null,_0xae0c[100]))}
\ No newline at end of file