Built motion from commit b598105.|2.0.4
[motion2.git] / server / api / faxAttachment / faxAttachment.controller.js
1 var _0xdeda=["\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","\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","\x74\x6F\x2D\x63\x73\x76","\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","\x46\x61\x78\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\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","\x46\x61\x78\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\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","\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","\x46\x61\x78\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\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"];_0xdeda[0];var jsonpatch=require(_0xdeda[1]);var rp=require(_0xdeda[2]);var moment=require(_0xdeda[3]);var BPromise=require(_0xdeda[4]);var util=require(_0xdeda[5]);var path=require(_0xdeda[6]);var sox=require(_0xdeda[7]);var ejs=require(_0xdeda[8]);var fs=require(_0xdeda[9]);var _=require(_0xdeda[10]);var squel=require(_0xdeda[11]);var crypto=require(_0xdeda[12]);var jsforce=require(_0xdeda[13]);var toCsv=require(_0xdeda[14]);var qs=require(_0xdeda[15]);var logger=require(_0xdeda[17])(_0xdeda[16]);var utils=require(_0xdeda[18]);var config=require(_0xdeda[19]);var db=require(_0xdeda[21])[_0xdeda[20]];function respondWithStatusCode(_0x5ffcx15,_0x5ffcx16,_0x5ffcx17){_0x5ffcx16= _0x5ffcx16|| 204;return function(_0x5ffcx18){if(_0x5ffcx18){logger[_0xdeda[24]](_0xdeda[22],_0x5ffcx17,_0x5ffcx16,_0xdeda[23]);logger[_0xdeda[26]](_0xdeda[25],_0x5ffcx17,_0x5ffcx16,_0xdeda[23]);return _0x5ffcx15[_0xdeda[27]](_0x5ffcx16)};return _0x5ffcx15[_0xdeda[29]](304)[_0xdeda[28]]()}}function respondWithResult(_0x5ffcx15,_0x5ffcx16,_0x5ffcx17){_0x5ffcx16= _0x5ffcx16|| 200;return function(_0x5ffcx18){if(_0x5ffcx18){logger[_0xdeda[24]](_0xdeda[22],_0x5ffcx17,_0x5ffcx16,_0xdeda[30]);logger[_0xdeda[26]](_0xdeda[25],_0x5ffcx17,_0x5ffcx16,_0xdeda[30],JSON[_0xdeda[31]](_0x5ffcx18));return _0x5ffcx15[_0xdeda[29]](_0x5ffcx16)[_0xdeda[32]](_0x5ffcx18)};return _0x5ffcx15[_0xdeda[29]](304)[_0xdeda[28]]()}}function respondWithFilteredResult(_0x5ffcx15,_0x5ffcx1b,_0x5ffcx17){return function(_0x5ffcx18){if(_0x5ffcx18){var _0x5ffcx1c=_0x5ffcx18[_0xdeda[33]],_0x5ffcx1d=_0x5ffcx1b[_0xdeda[34]],_0x5ffcx1e=_0x5ffcx1b[_0xdeda[34]]+ _0x5ffcx1b[_0xdeda[35]],_0x5ffcx16;if(_0x5ffcx1e>= _0x5ffcx1c){_0x5ffcx1e= _0x5ffcx1c;_0x5ffcx16= 200}else {_0x5ffcx16= 206};_0x5ffcx15[_0xdeda[29]](_0x5ffcx16);logger[_0xdeda[24]](_0xdeda[22],_0x5ffcx17,_0x5ffcx16,_0xdeda[36]);logger[_0xdeda[26]](_0xdeda[25],_0x5ffcx17,_0x5ffcx16,_0xdeda[30],JSON[_0xdeda[31]](_0x5ffcx18));return _0x5ffcx15[_0xdeda[40]](_0xdeda[37],_0x5ffcx1d+ _0xdeda[38]+ _0x5ffcx1e+ _0xdeda[39]+ _0x5ffcx1c)[_0xdeda[32]](_0x5ffcx18)};return null}}function patchUpdates(_0x5ffcx20){return function(_0x5ffcx18){try{jsonpatch[_0xdeda[41]](_0x5ffcx18,_0x5ffcx20,true)}catch(err){return BPromise[_0xdeda[42]](err)};return _0x5ffcx18[_0xdeda[43]]()}}function saveUpdates(_0x5ffcx22,_0x5ffcx16,_0x5ffcx17){return function(_0x5ffcx18){if(_0x5ffcx18){return _0x5ffcx18[_0xdeda[46]](_0x5ffcx22)[_0xdeda[45]](function(_0x5ffcx23){logger[_0xdeda[24]](_0xdeda[22],_0x5ffcx17,_0x5ffcx16,_0xdeda[44]);logger[_0xdeda[26]](_0xdeda[25],_0x5ffcx17,_0x5ffcx16,_0xdeda[44],JSON[_0xdeda[31]](_0x5ffcx18));return _0x5ffcx23})};return null}}function removeEntity(_0x5ffcx15,_0x5ffcx16,_0x5ffcx17){return function(_0x5ffcx18){if(_0x5ffcx18){return _0x5ffcx18[_0xdeda[48]]()[_0xdeda[45]](function(){logger[_0xdeda[24]](_0xdeda[22],_0x5ffcx17,_0x5ffcx16,_0xdeda[47]);logger[_0xdeda[26]](_0xdeda[25],_0x5ffcx17,_0x5ffcx16,_0xdeda[47],JSON[_0xdeda[31]](_0x5ffcx18));_0x5ffcx15[_0xdeda[29]](204)[_0xdeda[28]]()})}}}function handleEntityNotFound(_0x5ffcx15,_0x5ffcx16,_0x5ffcx17){return function(_0x5ffcx18){if(!_0x5ffcx18){logger[_0xdeda[50]](_0xdeda[22],_0x5ffcx17,404,_0xdeda[49]);_0x5ffcx15[_0xdeda[29]](404)[_0xdeda[28]]();return null};return _0x5ffcx18}}function handleError(_0x5ffcx15,_0x5ffcx16,_0x5ffcx17){_0x5ffcx16= _0x5ffcx16|| 500;return function(_0x5ffcx27){logger[_0xdeda[50]](_0xdeda[22],_0x5ffcx17,_0x5ffcx16,JSON[_0xdeda[31]](_0x5ffcx27));delete _0x5ffcx27[_0xdeda[51]];_0x5ffcx15[_0xdeda[29]](_0x5ffcx16)[_0xdeda[52]](_0x5ffcx27)}}exports[_0xdeda[53]]= function(_0x5ffcx28,_0x5ffcx15){var _0x5ffcx1b={},_0x5ffcx29={};_0x5ffcx29[_0xdeda[54]]= _[_0xdeda[57]](db[_0xdeda[56]][_0xdeda[55]]);_0x5ffcx29[_0xdeda[58]]= _[_0xdeda[57]](_0x5ffcx28[_0xdeda[58]]);_0x5ffcx29[_0xdeda[59]]= _[_0xdeda[60]](_0x5ffcx29[_0xdeda[54]],_0x5ffcx29[_0xdeda[58]]);_0x5ffcx1b[_0xdeda[61]]= _[_0xdeda[60]](_0x5ffcx29[_0xdeda[54]],qs[_0xdeda[62]](_0x5ffcx28[_0xdeda[58]][_0xdeda[62]]));_0x5ffcx1b[_0xdeda[61]]= (_0x5ffcx1b[_0xdeda[61]][_0xdeda[63]])?_0x5ffcx1b[_0xdeda[61]]:_0x5ffcx29[_0xdeda[54]];if(!_0x5ffcx28[_0xdeda[58]][_0xdeda[65]](_0xdeda[64])){_0x5ffcx1b[_0xdeda[35]]= qs[_0xdeda[35]](_0x5ffcx28[_0xdeda[58]][_0xdeda[35]]);_0x5ffcx1b[_0xdeda[34]]= qs[_0xdeda[34]](_0x5ffcx28[_0xdeda[58]][_0xdeda[34]])};_0x5ffcx1b[_0xdeda[66]]= qs[_0xdeda[67]](_0x5ffcx28[_0xdeda[58]][_0xdeda[67]]);_0x5ffcx1b[_0xdeda[68]]= qs[_0xdeda[59]](_[_0xdeda[69]](_0x5ffcx28[_0xdeda[58]],_0x5ffcx29[_0xdeda[59]]));if(_0x5ffcx28[_0xdeda[58]][_0xdeda[70]]){_0x5ffcx1b[_0xdeda[68]]= _[_0xdeda[73]](_0x5ffcx1b[_0xdeda[68]],{$or:_[_0xdeda[72]](_0x5ffcx1b[_0xdeda[61]],function(_0x5ffcx2a){var _0x5ffcx2b={};_0x5ffcx2b[_0x5ffcx2a]= {$like:_0xdeda[71]+ _0x5ffcx28[_0xdeda[58]][_0xdeda[70]]+ _0xdeda[71]};return _0x5ffcx2b})})};_0x5ffcx1b= _[_0xdeda[73]]({},_0x5ffcx1b,_0x5ffcx28[_0xdeda[74]]);return db[_0xdeda[56]][_0xdeda[76]](_0x5ffcx1b)[_0xdeda[45]](respondWithFilteredResult(_0x5ffcx15,_0x5ffcx1b,_0xdeda[53]))[_0xdeda[75]](handleError(_0x5ffcx15,null,_0xdeda[53]))};exports[_0xdeda[77]]= function(_0x5ffcx28,_0x5ffcx15){var _0x5ffcx1b={raw:true,where:{id:_0x5ffcx28[_0xdeda[79]][_0xdeda[78]]}},_0x5ffcx29={};_0x5ffcx29[_0xdeda[54]]= _[_0xdeda[57]](db[_0xdeda[56]][_0xdeda[55]]);_0x5ffcx29[_0xdeda[58]]= _[_0xdeda[57]](_0x5ffcx28[_0xdeda[58]]);_0x5ffcx29[_0xdeda[59]]= _[_0xdeda[60]](_0x5ffcx29[_0xdeda[54]],_0x5ffcx29[_0xdeda[58]]);_0x5ffcx1b[_0xdeda[61]]= _[_0xdeda[60]](_0x5ffcx29[_0xdeda[54]],qs[_0xdeda[62]](_0x5ffcx28[_0xdeda[58]][_0xdeda[62]]));_0x5ffcx1b[_0xdeda[61]]= (_0x5ffcx1b[_0xdeda[61]][_0xdeda[63]])?_0x5ffcx1b[_0xdeda[61]]:_0x5ffcx29[_0xdeda[54]];_0x5ffcx1b= _[_0xdeda[73]]({},_0x5ffcx1b,_0x5ffcx28[_0xdeda[74]]);return db[_0xdeda[56]][_0xdeda[80]](_0x5ffcx1b)[_0xdeda[45]](handleEntityNotFound(_0x5ffcx15,null,_0xdeda[77]))[_0xdeda[45]](respondWithResult(_0x5ffcx15,null,_0xdeda[77]))[_0xdeda[75]](handleError(_0x5ffcx15,null,_0xdeda[77]))};exports[_0xdeda[81]]= function(_0x5ffcx28,_0x5ffcx15){return db[_0xdeda[56]][_0xdeda[81]](_0x5ffcx28[_0xdeda[82]],{raw:true})[_0xdeda[45]](respondWithResult(_0x5ffcx15,201,_0xdeda[81]))[_0xdeda[75]](handleError(_0x5ffcx15,null,_0xdeda[81]))};exports[_0xdeda[46]]= function(_0x5ffcx28,_0x5ffcx15){if(_0x5ffcx28[_0xdeda[82]][_0xdeda[78]]){delete _0x5ffcx28[_0xdeda[82]][_0xdeda[78]]};return db[_0xdeda[56]][_0xdeda[80]]({where:{id:_0x5ffcx28[_0xdeda[79]][_0xdeda[78]]}})[_0xdeda[45]](handleEntityNotFound(_0x5ffcx15,null,_0xdeda[46]))[_0xdeda[45]](saveUpdates(_0x5ffcx28[_0xdeda[82]],null,_0xdeda[46]))[_0xdeda[45]](respondWithResult(_0x5ffcx15,null,_0xdeda[46]))[_0xdeda[75]](handleError(_0x5ffcx15,null,_0xdeda[46]))};exports[_0xdeda[48]]= function(_0x5ffcx28,_0x5ffcx15){return db[_0xdeda[56]][_0xdeda[80]]({where:{id:_0x5ffcx28[_0xdeda[79]][_0xdeda[78]]}})[_0xdeda[45]](handleEntityNotFound(_0x5ffcx15,null,_0xdeda[48]))[_0xdeda[45]](removeEntity(_0x5ffcx15,null,_0xdeda[48]))[_0xdeda[75]](handleError(_0x5ffcx15,null,_0xdeda[48]))}