Built motion from commit ab065936.|2.0.50
[motion2.git] / server / api / squareOdbc / squareOdbc.controller.js
index 552d290..f1df561 100644 (file)
@@ -1 +1 @@
-var _0xcdad=["\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","\x53\x71\x75\x61\x72\x65\x4F\x64\x62\x63\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","\x53\x71\x75\x61\x72\x65\x4F\x64\x62\x63\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","\x53\x71\x75\x61\x72\x65\x4F\x64\x62\x63","\x6B\x65\x79\x73","\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","\x74\x65\x73\x74","\x6F\x64\x62\x63","\x64\x73\x6E","\x6F\x70\x65\x6E\x53\x79\x6E\x63","\x63\x6C\x6F\x73\x65\x53\x79\x6E\x63"];_0xcdad[0];var jsonpatch=require(_0xcdad[1]);var rp=require(_0xcdad[2]);var moment=require(_0xcdad[3]);var BPromise=require(_0xcdad[4]);var Mustache=require(_0xcdad[5]);var util=require(_0xcdad[6]);var path=require(_0xcdad[7]);var sox=require(_0xcdad[8]);var csv=require(_0xcdad[9]);var ejs=require(_0xcdad[10]);var fs=require(_0xcdad[11]);var _=require(_0xcdad[12]);var squel=require(_0xcdad[13]);var crypto=require(_0xcdad[14]);var jsforce=require(_0xcdad[15]);var deskjs=require(_0xcdad[16]);var toCsv=require(_0xcdad[9]);var querystring=require(_0xcdad[17]);var qs=require(_0xcdad[18]);var logger=require(_0xcdad[20])(_0xcdad[19]);var utils=require(_0xcdad[21]);var config=require(_0xcdad[22]);var db=require(_0xcdad[24])[_0xcdad[23]];function respondWithStatusCode(_0x7762x19,_0x7762x1a,_0x7762x1b){_0x7762x1a= _0x7762x1a|| 204;return function(_0x7762x1c){if(_0x7762x1c){logger[_0xcdad[27]](_0xcdad[25],_0x7762x1b,_0x7762x1a,_0xcdad[26]);logger[_0xcdad[29]](_0xcdad[28],_0x7762x1b,_0x7762x1a,_0xcdad[26]);return _0x7762x19[_0xcdad[30]](_0x7762x1a)};return _0x7762x19[_0xcdad[32]](_0x7762x1a)[_0xcdad[31]]()}}function respondWithResult(_0x7762x19,_0x7762x1a,_0x7762x1b){_0x7762x1a= _0x7762x1a|| 200;return function(_0x7762x1c){if(_0x7762x1c){logger[_0xcdad[27]](_0xcdad[25],_0x7762x1b,_0x7762x1a,_0xcdad[33]);logger[_0xcdad[29]](_0xcdad[28],_0x7762x1b,_0x7762x1a,_0xcdad[33],JSON[_0xcdad[34]](_0x7762x1c));return _0x7762x19[_0xcdad[32]](_0x7762x1a)[_0xcdad[35]](_0x7762x1c)}}}function respondWithFilteredResult(_0x7762x19,_0x7762x1f,_0x7762x1b){return function(_0x7762x1c){if(_0x7762x1c){var _0x7762x20=_0x7762x1c[_0xcdad[36]],_0x7762x21=_0x7762x1f[_0xcdad[37]],_0x7762x22=_0x7762x1f[_0xcdad[37]]+ _0x7762x1f[_0xcdad[38]],_0x7762x1a;if(_0x7762x22>= _0x7762x20){_0x7762x22= _0x7762x20;_0x7762x1a= 200}else {_0x7762x1a= 206};_0x7762x19[_0xcdad[32]](_0x7762x1a);logger[_0xcdad[27]](_0xcdad[25],_0x7762x1b,_0x7762x1a,_0xcdad[39]);logger[_0xcdad[29]](_0xcdad[28],_0x7762x1b,_0x7762x1a,_0xcdad[33],JSON[_0xcdad[34]](_0x7762x1c));return _0x7762x19[_0xcdad[43]](_0xcdad[40],_0x7762x21+ _0xcdad[41]+ _0x7762x22+ _0xcdad[42]+ _0x7762x20)[_0xcdad[35]](_0x7762x1c)};return null}}function patchUpdates(_0x7762x24){return function(_0x7762x1c){try{jsonpatch[_0xcdad[44]](_0x7762x1c,_0x7762x24,true)}catch(err){return BPromise[_0xcdad[45]](err)};return _0x7762x1c[_0xcdad[46]]()}}function saveUpdates(_0x7762x26,_0x7762x1a,_0x7762x1b){return function(_0x7762x1c){if(_0x7762x1c){return _0x7762x1c[_0xcdad[49]](_0x7762x26)[_0xcdad[48]](function(_0x7762x27){logger[_0xcdad[27]](_0xcdad[25],_0x7762x1b,_0x7762x1a,_0xcdad[47]);logger[_0xcdad[29]](_0xcdad[28],_0x7762x1b,_0x7762x1a,_0xcdad[47],JSON[_0xcdad[34]](_0x7762x1c));return _0x7762x27})};return null}}function removeEntity(_0x7762x19,_0x7762x1a,_0x7762x1b){return function(_0x7762x1c){if(_0x7762x1c){return _0x7762x1c[_0xcdad[51]]()[_0xcdad[48]](function(){logger[_0xcdad[27]](_0xcdad[25],_0x7762x1b,_0x7762x1a,_0xcdad[50]);logger[_0xcdad[29]](_0xcdad[28],_0x7762x1b,_0x7762x1a,_0xcdad[50],JSON[_0xcdad[34]](_0x7762x1c));_0x7762x19[_0xcdad[32]](204)[_0xcdad[31]]()})}}}function handleEntityNotFound(_0x7762x19,_0x7762x1a,_0x7762x1b){return function(_0x7762x1c){if(!_0x7762x1c){logger[_0xcdad[53]](_0xcdad[25],_0x7762x1b,404,_0xcdad[52]);_0x7762x19[_0xcdad[30]](404)};return _0x7762x1c}}function handleError(_0x7762x19,_0x7762x1a,_0x7762x1b){_0x7762x1a= _0x7762x1a|| 500;return function(_0x7762x2b){logger[_0xcdad[53]](_0xcdad[25],_0x7762x1b,_0x7762x1a,util[_0xcdad[54]](_0x7762x2b,{showHidden:false,depth:null}));delete _0x7762x2b[_0xcdad[55]];_0x7762x19[_0xcdad[32]](_0x7762x1a)[_0xcdad[56]](_0x7762x2b)}}exports[_0xcdad[57]]= function(_0x7762x2c,_0x7762x19){var _0x7762x1f={},_0x7762x2d={},_0x7762x2e={count:0,rows:[]};_0x7762x2d[_0xcdad[58]]= _[_0xcdad[61]](db[_0xcdad[60]][_0xcdad[59]]);var _0x7762x2f={dateStart:_0x7762x2c[_0xcdad[63]][_0xcdad[62]],dateEnd:_0x7762x2c[_0xcdad[63]][_0xcdad[64]]};delete _0x7762x2c[_0xcdad[63]][_0xcdad[62]];delete _0x7762x2c[_0xcdad[63]][_0xcdad[64]];_0x7762x2d[_0xcdad[63]]= _[_0xcdad[61]](_0x7762x2c[_0xcdad[63]]);_0x7762x2d[_0xcdad[65]]= _[_0xcdad[66]](_0x7762x2d[_0xcdad[58]],_0x7762x2d[_0xcdad[63]]);_0x7762x1f[_0xcdad[67]]= _[_0xcdad[66]](_0x7762x2d[_0xcdad[58]],qs[_0xcdad[68]](_0x7762x2c[_0xcdad[63]][_0xcdad[68]]));_0x7762x1f[_0xcdad[67]]= (_0x7762x1f[_0xcdad[67]][_0xcdad[69]])?_0x7762x1f[_0xcdad[67]]:_0x7762x2d[_0xcdad[58]];if(!_0x7762x2c[_0xcdad[63]][_0xcdad[71]](_0xcdad[70])){_0x7762x1f[_0xcdad[38]]= qs[_0xcdad[38]](_0x7762x2c[_0xcdad[63]][_0xcdad[38]]);_0x7762x1f[_0xcdad[37]]= qs[_0xcdad[37]](_0x7762x2c[_0xcdad[63]][_0xcdad[37]])};_0x7762x1f[_0xcdad[72]]= qs[_0xcdad[73]](_0x7762x2c[_0xcdad[63]][_0xcdad[73]]);_0x7762x1f[_0xcdad[74]]= qs[_0xcdad[65]](_[_0xcdad[75]](_0x7762x2c[_0xcdad[63]],_0x7762x2d[_0xcdad[65]]));if(_0x7762x2f[_0xcdad[62]]){if(_0x7762x2f[_0xcdad[64]]){_0x7762x2f[_0xcdad[64]]= moment(_0x7762x2f[_0xcdad[64]])[_0xcdad[77]](1,_0xcdad[76])}else {_0x7762x2f[_0xcdad[64]]= moment(_0x7762x2f[_0xcdad[62]])[_0xcdad[77]](1,_0xcdad[76])};_[_0xcdad[78]](_0x7762x1f[_0xcdad[74]],{createdAt:{$gte:_0x7762x2f[_0xcdad[62]],$lte:_0x7762x2f[_0xcdad[64]]}})};if(_0x7762x2c[_0xcdad[63]][_0xcdad[79]]){_0x7762x1f[_0xcdad[74]]= _[_0xcdad[78]](_0x7762x1f[_0xcdad[74]],{$or:_[_0xcdad[81]](_0x7762x1f[_0xcdad[67]],function(_0x7762x30){var _0x7762x2e={};_0x7762x2e[_0x7762x30]= {$like:_0xcdad[80]+ _0x7762x2c[_0xcdad[63]][_0xcdad[79]]+ _0xcdad[80]};return _0x7762x2e})})};_0x7762x1f= _[_0xcdad[78]]({},_0x7762x1f,_0x7762x2c[_0xcdad[82]]);return db[_0xcdad[60]][_0xcdad[36]]({where:_0x7762x1f[_0xcdad[74]]})[_0xcdad[48]](function(_0x7762x20){_0x7762x2e[_0xcdad[36]]= _0x7762x20;if(_0x7762x2c[_0xcdad[63]][_0xcdad[85]]){_0x7762x1f[_0xcdad[86]]= [{all:true}]};return db[_0xcdad[60]][_0xcdad[87]](_0x7762x1f)})[_0xcdad[48]](function(_0x7762x31){_0x7762x2e[_0xcdad[84]]= _0x7762x31;return _0x7762x2e})[_0xcdad[48]](respondWithFilteredResult(_0x7762x19,_0x7762x1f,_0xcdad[57]))[_0xcdad[83]](handleError(_0x7762x19,null,_0xcdad[57]))};exports[_0xcdad[88]]= function(_0x7762x2c,_0x7762x19){var _0x7762x1f={raw:true,where:{id:_0x7762x2c[_0xcdad[90]][_0xcdad[89]]}},_0x7762x2d={};_0x7762x2d[_0xcdad[58]]= _[_0xcdad[61]](db[_0xcdad[60]][_0xcdad[59]]);_0x7762x2d[_0xcdad[63]]= _[_0xcdad[61]](_0x7762x2c[_0xcdad[63]]);_0x7762x2d[_0xcdad[65]]= _[_0xcdad[66]](_0x7762x2d[_0xcdad[58]],_0x7762x2d[_0xcdad[63]]);_0x7762x1f[_0xcdad[67]]= _[_0xcdad[66]](_0x7762x2d[_0xcdad[58]],qs[_0xcdad[68]](_0x7762x2c[_0xcdad[63]][_0xcdad[68]]));_0x7762x1f[_0xcdad[67]]= (_0x7762x1f[_0xcdad[67]][_0xcdad[69]])?_0x7762x1f[_0xcdad[67]]:_0x7762x2d[_0xcdad[58]];if(_0x7762x2c[_0xcdad[63]][_0xcdad[85]]){_0x7762x1f[_0xcdad[86]]= [{all:true}]};_0x7762x1f= _[_0xcdad[78]]({},_0x7762x1f,_0x7762x2c[_0xcdad[82]]);return db[_0xcdad[60]][_0xcdad[91]](_0x7762x1f)[_0xcdad[48]](handleEntityNotFound(_0x7762x19,null,_0xcdad[88]))[_0xcdad[48]](respondWithResult(_0x7762x19,null,_0xcdad[88]))[_0xcdad[83]](handleError(_0x7762x19,null,_0xcdad[88]))};exports[_0xcdad[92]]= function(_0x7762x2c,_0x7762x19){return db[_0xcdad[60]][_0xcdad[92]](_0x7762x2c[_0xcdad[93]],{})[_0xcdad[48]](respondWithResult(_0x7762x19,201,_0xcdad[92]))[_0xcdad[83]](handleError(_0x7762x19,null,_0xcdad[92]))};exports[_0xcdad[49]]= function(_0x7762x2c,_0x7762x19){if(_0x7762x2c[_0xcdad[93]][_0xcdad[89]]){delete _0x7762x2c[_0xcdad[93]][_0xcdad[89]]};return db[_0xcdad[60]][_0xcdad[91]]({where:{id:_0x7762x2c[_0xcdad[90]][_0xcdad[89]]}})[_0xcdad[48]](handleEntityNotFound(_0x7762x19,null,_0xcdad[49]))[_0xcdad[48]](saveUpdates(_0x7762x2c[_0xcdad[93]],null,_0xcdad[49]))[_0xcdad[48]](respondWithResult(_0x7762x19,null,_0xcdad[49]))[_0xcdad[83]](handleError(_0x7762x19,null,_0xcdad[49]))};exports[_0xcdad[51]]= function(_0x7762x2c,_0x7762x19){return db[_0xcdad[60]][_0xcdad[91]]({where:{id:_0x7762x2c[_0xcdad[90]][_0xcdad[89]]}})[_0xcdad[48]](handleEntityNotFound(_0x7762x19,null,_0xcdad[51]))[_0xcdad[48]](removeEntity(_0x7762x19,null,_0xcdad[51]))[_0xcdad[83]](handleError(_0x7762x19,null,_0xcdad[51]))};exports[_0xcdad[94]]= function(_0x7762x2c,_0x7762x19,_0x7762x32){var _0x7762x33;return db[_0xcdad[60]][_0xcdad[91]]({where:{id:_0x7762x2c[_0xcdad[90]][_0xcdad[89]]},attributes:[_0xcdad[89],_0xcdad[96]]})[_0xcdad[48]](handleEntityNotFound(_0x7762x19,null,_0xcdad[94]))[_0xcdad[48]](function(_0x7762x1c){if(_0x7762x1c){var db=require(_0xcdad[95])();db[_0xcdad[97]](_0x7762x1c[_0xcdad[96]]);db[_0xcdad[98]]();return _0x7762x1c}})[_0xcdad[48]](respondWithResult(_0x7762x19,null,_0xcdad[94]))[_0xcdad[83]](handleError(_0x7762x19,null,_0xcdad[94]))}
\ No newline at end of file
+var _0xabbf=["\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","\x53\x71\x75\x61\x72\x65\x4F\x64\x62\x63\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","\x53\x71\x75\x61\x72\x65\x4F\x64\x62\x63\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","\x53\x71\x75\x61\x72\x65\x4F\x64\x62\x63","\x6B\x65\x79\x73","\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","\x74\x65\x73\x74","\x6F\x64\x62\x63","\x64\x73\x6E","\x6F\x70\x65\x6E\x53\x79\x6E\x63","\x63\x6C\x6F\x73\x65\x53\x79\x6E\x63"];_0xabbf[0];var jsonpatch=require(_0xabbf[1]);var rp=require(_0xabbf[2]);var moment=require(_0xabbf[3]);var BPromise=require(_0xabbf[4]);var Mustache=require(_0xabbf[5]);var util=require(_0xabbf[6]);var path=require(_0xabbf[7]);var sox=require(_0xabbf[8]);var csv=require(_0xabbf[9]);var ejs=require(_0xabbf[10]);var fs=require(_0xabbf[11]);var _=require(_0xabbf[12]);var squel=require(_0xabbf[13]);var crypto=require(_0xabbf[14]);var jsforce=require(_0xabbf[15]);var deskjs=require(_0xabbf[16]);var toCsv=require(_0xabbf[9]);var querystring=require(_0xabbf[17]);var qs=require(_0xabbf[18]);var logger=require(_0xabbf[20])(_0xabbf[19]);var utils=require(_0xabbf[21]);var config=require(_0xabbf[22]);var db=require(_0xabbf[24])[_0xabbf[23]];function respondWithStatusCode(_0x3927x19,_0x3927x1a,_0x3927x1b){_0x3927x1a= _0x3927x1a|| 204;return function(_0x3927x1c){if(_0x3927x1c){logger[_0xabbf[27]](_0xabbf[25],_0x3927x1b,_0x3927x1a,_0xabbf[26]);logger[_0xabbf[29]](_0xabbf[28],_0x3927x1b,_0x3927x1a,_0xabbf[26]);return _0x3927x19[_0xabbf[30]](_0x3927x1a)};return _0x3927x19[_0xabbf[32]](_0x3927x1a)[_0xabbf[31]]()}}function respondWithResult(_0x3927x19,_0x3927x1a,_0x3927x1b){_0x3927x1a= _0x3927x1a|| 200;return function(_0x3927x1c){if(_0x3927x1c){logger[_0xabbf[27]](_0xabbf[25],_0x3927x1b,_0x3927x1a,_0xabbf[33]);logger[_0xabbf[29]](_0xabbf[28],_0x3927x1b,_0x3927x1a,_0xabbf[33],JSON[_0xabbf[34]](_0x3927x1c));return _0x3927x19[_0xabbf[32]](_0x3927x1a)[_0xabbf[35]](_0x3927x1c)}}}function respondWithFilteredResult(_0x3927x19,_0x3927x1f,_0x3927x1b){return function(_0x3927x1c){if(_0x3927x1c){var _0x3927x20=_0x3927x1c[_0xabbf[36]],_0x3927x21=_0x3927x1f[_0xabbf[37]],_0x3927x22=_0x3927x1f[_0xabbf[37]]+ _0x3927x1f[_0xabbf[38]],_0x3927x1a;if(_0x3927x22>= _0x3927x20){_0x3927x22= _0x3927x20;_0x3927x1a= 200}else {_0x3927x1a= 206};_0x3927x19[_0xabbf[32]](_0x3927x1a);logger[_0xabbf[27]](_0xabbf[25],_0x3927x1b,_0x3927x1a,_0xabbf[39]);logger[_0xabbf[29]](_0xabbf[28],_0x3927x1b,_0x3927x1a,_0xabbf[33],JSON[_0xabbf[34]](_0x3927x1c));return _0x3927x19[_0xabbf[43]](_0xabbf[40],_0x3927x21+ _0xabbf[41]+ _0x3927x22+ _0xabbf[42]+ _0x3927x20)[_0xabbf[35]](_0x3927x1c)};return null}}function patchUpdates(_0x3927x24){return function(_0x3927x1c){try{jsonpatch[_0xabbf[44]](_0x3927x1c,_0x3927x24,true)}catch(err){return BPromise[_0xabbf[45]](err)};return _0x3927x1c[_0xabbf[46]]()}}function saveUpdates(_0x3927x26,_0x3927x1a,_0x3927x1b){return function(_0x3927x1c){if(_0x3927x1c){return _0x3927x1c[_0xabbf[49]](_0x3927x26)[_0xabbf[48]](function(_0x3927x27){logger[_0xabbf[27]](_0xabbf[25],_0x3927x1b,_0x3927x1a,_0xabbf[47]);logger[_0xabbf[29]](_0xabbf[28],_0x3927x1b,_0x3927x1a,_0xabbf[47],JSON[_0xabbf[34]](_0x3927x1c));return _0x3927x27})};return null}}function removeEntity(_0x3927x19,_0x3927x1a,_0x3927x1b){return function(_0x3927x1c){if(_0x3927x1c){return _0x3927x1c[_0xabbf[51]]()[_0xabbf[48]](function(){logger[_0xabbf[27]](_0xabbf[25],_0x3927x1b,_0x3927x1a,_0xabbf[50]);logger[_0xabbf[29]](_0xabbf[28],_0x3927x1b,_0x3927x1a,_0xabbf[50],JSON[_0xabbf[34]](_0x3927x1c));_0x3927x19[_0xabbf[32]](204)[_0xabbf[31]]()})}}}function handleEntityNotFound(_0x3927x19,_0x3927x1a,_0x3927x1b){return function(_0x3927x1c){if(!_0x3927x1c){logger[_0xabbf[53]](_0xabbf[25],_0x3927x1b,404,_0xabbf[52]);_0x3927x19[_0xabbf[30]](404)};return _0x3927x1c}}function handleError(_0x3927x19,_0x3927x1a,_0x3927x1b){_0x3927x1a= _0x3927x1a|| 500;return function(_0x3927x2b){logger[_0xabbf[53]](_0xabbf[25],_0x3927x1b,_0x3927x1a,util[_0xabbf[54]](_0x3927x2b,{showHidden:false,depth:null}));delete _0x3927x2b[_0xabbf[55]];_0x3927x19[_0xabbf[32]](_0x3927x1a)[_0xabbf[56]](_0x3927x2b)}}exports[_0xabbf[57]]= function(_0x3927x2c,_0x3927x19){var _0x3927x1f={},_0x3927x2d={},_0x3927x2e={count:0,rows:[]};_0x3927x2d[_0xabbf[58]]= _[_0xabbf[61]](db[_0xabbf[60]][_0xabbf[59]]);var _0x3927x2f={dateStart:_0x3927x2c[_0xabbf[63]][_0xabbf[62]],dateEnd:_0x3927x2c[_0xabbf[63]][_0xabbf[64]]};delete _0x3927x2c[_0xabbf[63]][_0xabbf[62]];delete _0x3927x2c[_0xabbf[63]][_0xabbf[64]];_0x3927x2d[_0xabbf[63]]= _[_0xabbf[61]](_0x3927x2c[_0xabbf[63]]);_0x3927x2d[_0xabbf[65]]= _[_0xabbf[66]](_0x3927x2d[_0xabbf[58]],_0x3927x2d[_0xabbf[63]]);_0x3927x1f[_0xabbf[67]]= _[_0xabbf[66]](_0x3927x2d[_0xabbf[58]],qs[_0xabbf[68]](_0x3927x2c[_0xabbf[63]][_0xabbf[68]]));_0x3927x1f[_0xabbf[67]]= (_0x3927x1f[_0xabbf[67]][_0xabbf[69]])?_0x3927x1f[_0xabbf[67]]:_0x3927x2d[_0xabbf[58]];if(!_0x3927x2c[_0xabbf[63]][_0xabbf[71]](_0xabbf[70])){_0x3927x1f[_0xabbf[38]]= qs[_0xabbf[38]](_0x3927x2c[_0xabbf[63]][_0xabbf[38]]);_0x3927x1f[_0xabbf[37]]= qs[_0xabbf[37]](_0x3927x2c[_0xabbf[63]][_0xabbf[37]])};_0x3927x1f[_0xabbf[72]]= qs[_0xabbf[73]](_0x3927x2c[_0xabbf[63]][_0xabbf[73]]);_0x3927x1f[_0xabbf[74]]= qs[_0xabbf[65]](_[_0xabbf[75]](_0x3927x2c[_0xabbf[63]],_0x3927x2d[_0xabbf[65]]));if(_0x3927x2f[_0xabbf[62]]){if(_0x3927x2f[_0xabbf[64]]){_0x3927x2f[_0xabbf[64]]= moment(_0x3927x2f[_0xabbf[64]])[_0xabbf[77]](1,_0xabbf[76])}else {_0x3927x2f[_0xabbf[64]]= moment(_0x3927x2f[_0xabbf[62]])[_0xabbf[77]](1,_0xabbf[76])};_[_0xabbf[78]](_0x3927x1f[_0xabbf[74]],{createdAt:{$gte:_0x3927x2f[_0xabbf[62]],$lte:_0x3927x2f[_0xabbf[64]]}})};if(_0x3927x2c[_0xabbf[63]][_0xabbf[79]]){_0x3927x1f[_0xabbf[74]]= _[_0xabbf[78]](_0x3927x1f[_0xabbf[74]],{$or:_[_0xabbf[81]](_0x3927x1f[_0xabbf[67]],function(_0x3927x30){var _0x3927x2e={};_0x3927x2e[_0x3927x30]= {$like:_0xabbf[80]+ _0x3927x2c[_0xabbf[63]][_0xabbf[79]]+ _0xabbf[80]};return _0x3927x2e})})};_0x3927x1f= _[_0xabbf[78]]({},_0x3927x1f,_0x3927x2c[_0xabbf[82]]);return db[_0xabbf[60]][_0xabbf[36]]({where:_0x3927x1f[_0xabbf[74]]})[_0xabbf[48]](function(_0x3927x20){_0x3927x2e[_0xabbf[36]]= _0x3927x20;if(_0x3927x2c[_0xabbf[63]][_0xabbf[85]]){_0x3927x1f[_0xabbf[86]]= [{all:true}]};return db[_0xabbf[60]][_0xabbf[87]](_0x3927x1f)})[_0xabbf[48]](function(_0x3927x31){_0x3927x2e[_0xabbf[84]]= _0x3927x31;return _0x3927x2e})[_0xabbf[48]](respondWithFilteredResult(_0x3927x19,_0x3927x1f,_0xabbf[57]))[_0xabbf[83]](handleError(_0x3927x19,null,_0xabbf[57]))};exports[_0xabbf[88]]= function(_0x3927x2c,_0x3927x19){var _0x3927x1f={raw:true,where:{id:_0x3927x2c[_0xabbf[90]][_0xabbf[89]]}},_0x3927x2d={};_0x3927x2d[_0xabbf[58]]= _[_0xabbf[61]](db[_0xabbf[60]][_0xabbf[59]]);_0x3927x2d[_0xabbf[63]]= _[_0xabbf[61]](_0x3927x2c[_0xabbf[63]]);_0x3927x2d[_0xabbf[65]]= _[_0xabbf[66]](_0x3927x2d[_0xabbf[58]],_0x3927x2d[_0xabbf[63]]);_0x3927x1f[_0xabbf[67]]= _[_0xabbf[66]](_0x3927x2d[_0xabbf[58]],qs[_0xabbf[68]](_0x3927x2c[_0xabbf[63]][_0xabbf[68]]));_0x3927x1f[_0xabbf[67]]= (_0x3927x1f[_0xabbf[67]][_0xabbf[69]])?_0x3927x1f[_0xabbf[67]]:_0x3927x2d[_0xabbf[58]];if(_0x3927x2c[_0xabbf[63]][_0xabbf[85]]){_0x3927x1f[_0xabbf[86]]= [{all:true}]};_0x3927x1f= _[_0xabbf[78]]({},_0x3927x1f,_0x3927x2c[_0xabbf[82]]);return db[_0xabbf[60]][_0xabbf[91]](_0x3927x1f)[_0xabbf[48]](handleEntityNotFound(_0x3927x19,null,_0xabbf[88]))[_0xabbf[48]](respondWithResult(_0x3927x19,null,_0xabbf[88]))[_0xabbf[83]](handleError(_0x3927x19,null,_0xabbf[88]))};exports[_0xabbf[92]]= function(_0x3927x2c,_0x3927x19){return db[_0xabbf[60]][_0xabbf[92]](_0x3927x2c[_0xabbf[93]],{})[_0xabbf[48]](respondWithResult(_0x3927x19,201,_0xabbf[92]))[_0xabbf[83]](handleError(_0x3927x19,null,_0xabbf[92]))};exports[_0xabbf[49]]= function(_0x3927x2c,_0x3927x19){if(_0x3927x2c[_0xabbf[93]][_0xabbf[89]]){delete _0x3927x2c[_0xabbf[93]][_0xabbf[89]]};return db[_0xabbf[60]][_0xabbf[91]]({where:{id:_0x3927x2c[_0xabbf[90]][_0xabbf[89]]}})[_0xabbf[48]](handleEntityNotFound(_0x3927x19,null,_0xabbf[49]))[_0xabbf[48]](saveUpdates(_0x3927x2c[_0xabbf[93]],null,_0xabbf[49]))[_0xabbf[48]](respondWithResult(_0x3927x19,null,_0xabbf[49]))[_0xabbf[83]](handleError(_0x3927x19,null,_0xabbf[49]))};exports[_0xabbf[51]]= function(_0x3927x2c,_0x3927x19){return db[_0xabbf[60]][_0xabbf[91]]({where:{id:_0x3927x2c[_0xabbf[90]][_0xabbf[89]]}})[_0xabbf[48]](handleEntityNotFound(_0x3927x19,null,_0xabbf[51]))[_0xabbf[48]](removeEntity(_0x3927x19,null,_0xabbf[51]))[_0xabbf[83]](handleError(_0x3927x19,null,_0xabbf[51]))};exports[_0xabbf[94]]= function(_0x3927x2c,_0x3927x19,_0x3927x32){var _0x3927x33;return db[_0xabbf[60]][_0xabbf[91]]({where:{id:_0x3927x2c[_0xabbf[90]][_0xabbf[89]]},attributes:[_0xabbf[89],_0xabbf[96]]})[_0xabbf[48]](handleEntityNotFound(_0x3927x19,null,_0xabbf[94]))[_0xabbf[48]](function(_0x3927x1c){if(_0x3927x1c){var db=require(_0xabbf[95])();db[_0xabbf[97]](_0x3927x1c[_0xabbf[96]]);db[_0xabbf[98]]();return _0x3927x1c}})[_0xabbf[48]](respondWithResult(_0x3927x19,null,_0xabbf[94]))[_0xabbf[83]](handleError(_0x3927x19,null,_0xabbf[94]))}
\ No newline at end of file