Built motion from commit 685965e4.|2.0.32
[motion2.git] / server / api / openchannelReport / openchannelReport.controller.js
1 var _0xc0a3=["\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","\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","\x74\x6F\x2D\x63\x73\x76","\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","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x52\x65\x70\x6F\x72\x74\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","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x52\x65\x70\x6F\x72\x74\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","\x4F\x70\x65\x6E\x63\x68\x61\x6E\x6E\x65\x6C\x52\x65\x70\x6F\x72\x74","\x6B\x65\x79\x73","\x71\x75\x65\x72\x79","\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","\x66\x69\x6C\x74\x65\x72","\x25","\x6D\x61\x70","\x6D\x65\x72\x67\x65","\x6F\x70\x74\x69\x6F\x6E\x73","\x63\x61\x74\x63\x68","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\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"];_0xc0a3[0];var jsonpatch=require(_0xc0a3[1]);var rp=require(_0xc0a3[2]);var moment=require(_0xc0a3[3]);var BPromise=require(_0xc0a3[4]);var Mustache=require(_0xc0a3[5]);var util=require(_0xc0a3[6]);var path=require(_0xc0a3[7]);var sox=require(_0xc0a3[8]);var ejs=require(_0xc0a3[9]);var fs=require(_0xc0a3[10]);var _=require(_0xc0a3[11]);var squel=require(_0xc0a3[12]);var crypto=require(_0xc0a3[13]);var jsforce=require(_0xc0a3[14]);var deskjs=require(_0xc0a3[15]);var toCsv=require(_0xc0a3[16]);var querystring=require(_0xc0a3[17]);var qs=require(_0xc0a3[18]);var logger=require(_0xc0a3[20])(_0xc0a3[19]);var utils=require(_0xc0a3[21]);var config=require(_0xc0a3[22]);var db=require(_0xc0a3[24])[_0xc0a3[23]];function respondWithStatusCode(_0xffa5x18,_0xffa5x19,_0xffa5x1a){_0xffa5x19= _0xffa5x19|| 204;return function(_0xffa5x1b){if(_0xffa5x1b){logger[_0xc0a3[27]](_0xc0a3[25],_0xffa5x1a,_0xffa5x19,_0xc0a3[26]);logger[_0xc0a3[29]](_0xc0a3[28],_0xffa5x1a,_0xffa5x19,_0xc0a3[26]);return _0xffa5x18[_0xc0a3[30]](_0xffa5x19)};return _0xffa5x18[_0xc0a3[32]](304)[_0xc0a3[31]]()}}function respondWithResult(_0xffa5x18,_0xffa5x19,_0xffa5x1a){_0xffa5x19= _0xffa5x19|| 200;return function(_0xffa5x1b){if(_0xffa5x1b){logger[_0xc0a3[27]](_0xc0a3[25],_0xffa5x1a,_0xffa5x19,_0xc0a3[33]);logger[_0xc0a3[29]](_0xc0a3[28],_0xffa5x1a,_0xffa5x19,_0xc0a3[33],JSON[_0xc0a3[34]](_0xffa5x1b));return _0xffa5x18[_0xc0a3[32]](_0xffa5x19)[_0xc0a3[35]](_0xffa5x1b)};return _0xffa5x18[_0xc0a3[32]](304)[_0xc0a3[31]]()}}function respondWithFilteredResult(_0xffa5x18,_0xffa5x1e,_0xffa5x1a){return function(_0xffa5x1b){if(_0xffa5x1b){var _0xffa5x1f=_0xffa5x1b[_0xc0a3[36]],_0xffa5x20=_0xffa5x1e[_0xc0a3[37]],_0xffa5x21=_0xffa5x1e[_0xc0a3[37]]+ _0xffa5x1e[_0xc0a3[38]],_0xffa5x19;if(_0xffa5x21>= _0xffa5x1f){_0xffa5x21= _0xffa5x1f;_0xffa5x19= 200}else {_0xffa5x19= 206};_0xffa5x18[_0xc0a3[32]](_0xffa5x19);logger[_0xc0a3[27]](_0xc0a3[25],_0xffa5x1a,_0xffa5x19,_0xc0a3[39]);logger[_0xc0a3[29]](_0xc0a3[28],_0xffa5x1a,_0xffa5x19,_0xc0a3[33],JSON[_0xc0a3[34]](_0xffa5x1b));return _0xffa5x18[_0xc0a3[43]](_0xc0a3[40],_0xffa5x20+ _0xc0a3[41]+ _0xffa5x21+ _0xc0a3[42]+ _0xffa5x1f)[_0xc0a3[35]](_0xffa5x1b)};return null}}function patchUpdates(_0xffa5x23){return function(_0xffa5x1b){try{jsonpatch[_0xc0a3[44]](_0xffa5x1b,_0xffa5x23,true)}catch(err){return BPromise[_0xc0a3[45]](err)};return _0xffa5x1b[_0xc0a3[46]]()}}function saveUpdates(_0xffa5x25,_0xffa5x19,_0xffa5x1a){return function(_0xffa5x1b){if(_0xffa5x1b){return _0xffa5x1b[_0xc0a3[49]](_0xffa5x25)[_0xc0a3[48]](function(_0xffa5x26){logger[_0xc0a3[27]](_0xc0a3[25],_0xffa5x1a,_0xffa5x19,_0xc0a3[47]);logger[_0xc0a3[29]](_0xc0a3[28],_0xffa5x1a,_0xffa5x19,_0xc0a3[47],JSON[_0xc0a3[34]](_0xffa5x1b));return _0xffa5x26})};return null}}function removeEntity(_0xffa5x18,_0xffa5x19,_0xffa5x1a){return function(_0xffa5x1b){if(_0xffa5x1b){return _0xffa5x1b[_0xc0a3[51]]()[_0xc0a3[48]](function(){logger[_0xc0a3[27]](_0xc0a3[25],_0xffa5x1a,_0xffa5x19,_0xc0a3[50]);logger[_0xc0a3[29]](_0xc0a3[28],_0xffa5x1a,_0xffa5x19,_0xc0a3[50],JSON[_0xc0a3[34]](_0xffa5x1b));_0xffa5x18[_0xc0a3[32]](204)[_0xc0a3[31]]()})}}}function handleEntityNotFound(_0xffa5x18,_0xffa5x19,_0xffa5x1a){return function(_0xffa5x1b){if(!_0xffa5x1b){logger[_0xc0a3[53]](_0xc0a3[25],_0xffa5x1a,404,_0xc0a3[52]);return _0xffa5x18[_0xc0a3[30]](404)};return _0xffa5x1b}}function handleError(_0xffa5x18,_0xffa5x19,_0xffa5x1a){_0xffa5x19= _0xffa5x19|| 500;return function(_0xffa5x2a){logger[_0xc0a3[53]](_0xc0a3[25],_0xffa5x1a,_0xffa5x19,util[_0xc0a3[54]](_0xffa5x2a,{showHidden:false,depth:null}));delete _0xffa5x2a[_0xc0a3[55]];_0xffa5x18[_0xc0a3[32]](_0xffa5x19)[_0xc0a3[56]](_0xffa5x2a)}}exports[_0xc0a3[57]]= function(_0xffa5x2b,_0xffa5x18){var _0xffa5x1e={},_0xffa5x2c={};_0xffa5x2c[_0xc0a3[58]]= _[_0xc0a3[61]](db[_0xc0a3[60]][_0xc0a3[59]]);_0xffa5x2c[_0xc0a3[62]]= _[_0xc0a3[61]](_0xffa5x2b[_0xc0a3[62]]);_0xffa5x2c[_0xc0a3[63]]= _[_0xc0a3[64]](_0xffa5x2c[_0xc0a3[58]],_0xffa5x2c[_0xc0a3[62]]);_0xffa5x1e[_0xc0a3[65]]= _[_0xc0a3[64]](_0xffa5x2c[_0xc0a3[58]],qs[_0xc0a3[66]](_0xffa5x2b[_0xc0a3[62]][_0xc0a3[66]]));_0xffa5x1e[_0xc0a3[65]]= (_0xffa5x1e[_0xc0a3[65]][_0xc0a3[67]])?_0xffa5x1e[_0xc0a3[65]]:_0xffa5x2c[_0xc0a3[58]];if(!_0xffa5x2b[_0xc0a3[62]][_0xc0a3[69]](_0xc0a3[68])){_0xffa5x1e[_0xc0a3[38]]= qs[_0xc0a3[38]](_0xffa5x2b[_0xc0a3[62]][_0xc0a3[38]]);_0xffa5x1e[_0xc0a3[37]]= qs[_0xc0a3[37]](_0xffa5x2b[_0xc0a3[62]][_0xc0a3[37]])};_0xffa5x1e[_0xc0a3[70]]= qs[_0xc0a3[71]](_0xffa5x2b[_0xc0a3[62]][_0xc0a3[71]]);_0xffa5x1e[_0xc0a3[72]]= qs[_0xc0a3[63]](_[_0xc0a3[73]](_0xffa5x2b[_0xc0a3[62]],_0xffa5x2c[_0xc0a3[63]]));if(_0xffa5x2b[_0xc0a3[62]][_0xc0a3[74]]){_0xffa5x1e[_0xc0a3[72]]= _[_0xc0a3[77]](_0xffa5x1e[_0xc0a3[72]],{$or:_[_0xc0a3[76]](_0xffa5x1e[_0xc0a3[65]],function(_0xffa5x2d){var _0xffa5x2e={};_0xffa5x2e[_0xffa5x2d]= {$like:_0xc0a3[75]+ _0xffa5x2b[_0xc0a3[62]][_0xc0a3[74]]+ _0xc0a3[75]};return _0xffa5x2e})})};_0xffa5x1e= _[_0xc0a3[77]]({},_0xffa5x1e,_0xffa5x2b[_0xc0a3[78]]);return db[_0xc0a3[60]][_0xc0a3[80]](_0xffa5x1e)[_0xc0a3[48]](respondWithFilteredResult(_0xffa5x18,_0xffa5x1e,_0xc0a3[57]))[_0xc0a3[79]](handleError(_0xffa5x18,null,_0xc0a3[57]))};exports[_0xc0a3[81]]= function(_0xffa5x2b,_0xffa5x18){var _0xffa5x1e={raw:true,where:{id:_0xffa5x2b[_0xc0a3[83]][_0xc0a3[82]]}},_0xffa5x2c={};_0xffa5x2c[_0xc0a3[58]]= _[_0xc0a3[61]](db[_0xc0a3[60]][_0xc0a3[59]]);_0xffa5x2c[_0xc0a3[62]]= _[_0xc0a3[61]](_0xffa5x2b[_0xc0a3[62]]);_0xffa5x2c[_0xc0a3[63]]= _[_0xc0a3[64]](_0xffa5x2c[_0xc0a3[58]],_0xffa5x2c[_0xc0a3[62]]);_0xffa5x1e[_0xc0a3[65]]= _[_0xc0a3[64]](_0xffa5x2c[_0xc0a3[58]],qs[_0xc0a3[66]](_0xffa5x2b[_0xc0a3[62]][_0xc0a3[66]]));_0xffa5x1e[_0xc0a3[65]]= (_0xffa5x1e[_0xc0a3[65]][_0xc0a3[67]])?_0xffa5x1e[_0xc0a3[65]]:_0xffa5x2c[_0xc0a3[58]];_0xffa5x1e= _[_0xc0a3[77]]({},_0xffa5x1e,_0xffa5x2b[_0xc0a3[78]]);return db[_0xc0a3[60]][_0xc0a3[84]](_0xffa5x1e)[_0xc0a3[48]](handleEntityNotFound(_0xffa5x18,null,_0xc0a3[81]))[_0xc0a3[48]](respondWithResult(_0xffa5x18,null,_0xc0a3[81]))[_0xc0a3[79]](handleError(_0xffa5x18,null,_0xc0a3[81]))};exports[_0xc0a3[85]]= function(_0xffa5x2b,_0xffa5x18){return db[_0xc0a3[60]][_0xc0a3[85]](_0xffa5x2b[_0xc0a3[86]],{})[_0xc0a3[48]](respondWithResult(_0xffa5x18,201,_0xc0a3[85]))[_0xc0a3[79]](handleError(_0xffa5x18,null,_0xc0a3[85]))};exports[_0xc0a3[49]]= function(_0xffa5x2b,_0xffa5x18){if(_0xffa5x2b[_0xc0a3[86]][_0xc0a3[82]]){delete _0xffa5x2b[_0xc0a3[86]][_0xc0a3[82]]};return db[_0xc0a3[60]][_0xc0a3[84]]({where:{id:_0xffa5x2b[_0xc0a3[83]][_0xc0a3[82]]}})[_0xc0a3[48]](handleEntityNotFound(_0xffa5x18,null,_0xc0a3[49]))[_0xc0a3[48]](saveUpdates(_0xffa5x2b[_0xc0a3[86]],null,_0xc0a3[49]))[_0xc0a3[48]](respondWithResult(_0xffa5x18,null,_0xc0a3[49]))[_0xc0a3[79]](handleError(_0xffa5x18,null,_0xc0a3[49]))};exports[_0xc0a3[51]]= function(_0xffa5x2b,_0xffa5x18){return db[_0xc0a3[60]][_0xc0a3[84]]({where:{id:_0xffa5x2b[_0xc0a3[83]][_0xc0a3[82]]}})[_0xc0a3[48]](handleEntityNotFound(_0xffa5x18,null,_0xc0a3[51]))[_0xc0a3[48]](removeEntity(_0xffa5x18,null,_0xc0a3[51]))[_0xc0a3[79]](handleError(_0xffa5x18,null,_0xc0a3[51]))}