d347fba913d3752ae1703f399cf2d210770b7b89
[motion.git] / server / api / fax_attachment / fax_attachment.controller.js
1 var _0x401c=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x70\x61\x74\x68","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x66\x6F\x72\x6D\x69\x64\x61\x62\x6C\x65","\x62\x6C\x75\x65\x62\x69\x72\x64","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x46\x61\x78\x41\x74\x74\x61\x63\x68\x6D\x65\x6E\x74","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x65\x6E\x64","\x74\x68\x65\x6E","\x75\x70\x64\x61\x74\x65\x41\x74\x74\x72\x69\x62\x75\x74\x65\x73","\x64\x65\x73\x74\x72\x6F\x79","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x46\x69\x6C\x65","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x75\x70\x6C\x6F\x61\x64\x44\x69\x72","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72","\x66\x69\x6C\x65\x73","\x66\x61\x78","\x6F\x75\x74\x62\x6F\x75\x6E\x64","\x6F\x72\x69\x67\x69\x6E\x61\x6C","\x6A\x6F\x69\x6E","\x6B\x65\x65\x70\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E\x73","\x6D\x75\x6C\x74\x69\x70\x6C\x65\x73","\x68\x61\x73\x68","\x66\x69\x6C\x65","\x6E\x61\x6D\x65","\x62\x61\x73\x65\x6E\x61\x6D\x65","\x70\x61\x72\x73\x65","\x75\x70\x64\x61\x74\x65","\x62\x6F\x64\x79","\x75\x6E\x6C\x69\x6E\x6B","\x66\x73","\x70\x72\x6F\x6D\x69\x73\x69\x66\x79"];_0x401c[0];var _=require(_0x401c[1]);var path=require(_0x401c[2]);var Util=require(_0x401c[3]);var formidable=require(_0x401c[4]);var Promise=require(_0x401c[5]);var config=require(_0x401c[6]);var FaxAttachment=require(_0x401c[8])[_0x401c[7]];function handleError(_0x9b7fx9,_0x9b7fxa){_0x9b7fxa=_0x9b7fxa||500;return function(_0x9b7fxb){_0x9b7fx9[_0x401c[10]](_0x9b7fxa)[_0x401c[9]](_0x9b7fxb)}}function responseWithResult(_0x9b7fx9,_0x9b7fxa){_0x9b7fxa=_0x9b7fxa||200;return function(_0x9b7fxd){if(_0x9b7fxd){_0x9b7fx9[_0x401c[10]](_0x9b7fxa)[_0x401c[11]](_0x9b7fxd)}}}function responseWithoutResult(_0x9b7fx9,_0x9b7fxa){_0x9b7fxa=_0x9b7fxa||204;return function(){_0x9b7fx9[_0x401c[12]](_0x9b7fxa)}}function handleEntityNotFound(_0x9b7fx9){return function(_0x9b7fxd){if(!_0x9b7fxd){_0x9b7fx9[_0x401c[10]](404)[_0x401c[13]]();return null};return _0x9b7fxd}}function saveUpdates(_0x9b7fx11){return function(_0x9b7fxd){return _0x9b7fxd[_0x401c[15]](_0x9b7fx11)[_0x401c[14]](function(_0x9b7fx12){return _0x9b7fx12})}}function removeEntity(_0x9b7fx9){return function(_0x9b7fxd){if(_0x9b7fxd){return _0x9b7fxd[_0x401c[16]]()[_0x401c[14]](function(){_0x9b7fx9[_0x401c[10]](204)[_0x401c[13]]()})}}}exports[_0x401c[17]]=function(_0x9b7fx14,_0x9b7fx9){return FaxAttachment[_0x401c[21]](Util[_0x401c[20]](_0x9b7fx14[_0x401c[19]]))[_0x401c[14]](responseWithResult(_0x9b7fx9))[_0x401c[18]](handleError(_0x9b7fx9))};exports[_0x401c[22]]=function(_0x9b7fx14,_0x9b7fx9){return FaxAttachment[_0x401c[26]](_0x9b7fx14[_0x401c[25]][_0x401c[24]])[_0x401c[14]](handleEntityNotFound(_0x9b7fx9))[_0x401c[14]](function(_0x9b7fx15){return _0x9b7fx9[_0x401c[23]](_0x9b7fx15[_0x401c[2]])})[_0x401c[18]](handleError(_0x9b7fx9))};exports[_0x401c[27]]=function(_0x9b7fx14,_0x9b7fx9){var _0x9b7fx16= new formidable.IncomingForm();_0x9b7fx16[_0x401c[28]]=path[_0x401c[35]](config[_0x401c[29]],_0x401c[30],_0x401c[31],_0x401c[32],_0x401c[33],_0x401c[34]);_0x9b7fx16[_0x401c[36]]=true;_0x9b7fx16[_0x401c[37]]=true;_0x9b7fx16[_0x401c[38]]=true;_0x9b7fx16[_0x401c[42]](_0x9b7fx14,function(_0x9b7fxb,_0x9b7fx16,_0x9b7fx17){if(_0x9b7fxb){return _0x9b7fx9[_0x401c[10]](500)[_0x401c[9]](_0x9b7fxb)};return _0x9b7fx9[_0x401c[10]](201)[_0x401c[9]]({path:_0x9b7fx17[_0x401c[39]][_0x401c[2]],name:_0x9b7fx17[_0x401c[39]][_0x401c[40]],basename:path[_0x401c[41]](_0x9b7fx17[_0x401c[39]][_0x401c[2]])})})};exports[_0x401c[43]]=function(_0x9b7fx14,_0x9b7fx9){if(_0x9b7fx14[_0x401c[44]][_0x401c[24]]){delete _0x9b7fx14[_0x401c[44]][_0x401c[24]]};return FaxAttachment[_0x401c[26]](_0x9b7fx14[_0x401c[25]][_0x401c[24]])[_0x401c[14]](handleEntityNotFound(_0x9b7fx9))[_0x401c[14]](saveUpdates(_0x9b7fx14[_0x401c[44]]))[_0x401c[14]](responseWithResult(_0x9b7fx9))[_0x401c[18]](handleError(_0x9b7fx9))};exports[_0x401c[16]]=function(_0x9b7fx14,_0x9b7fx9){var _0x9b7fx18=Promise[_0x401c[47]](require(_0x401c[46])[_0x401c[45]]);var _0x9b7fx19=path[_0x401c[35]](config[_0x401c[29]],_0x401c[30],_0x401c[31],_0x401c[32],_0x401c[33],_0x401c[34],_0x9b7fx14[_0x401c[25]][_0x401c[24]]);return _0x9b7fx18(_0x9b7fx19)[_0x401c[14]](function(){return _0x9b7fx9[_0x401c[12]](204)})[_0x401c[18]](function(_0x9b7fxb){return handleError(_0x9b7fx9,_0x9b7fxb)})}