Built motion from commit a81f050.|0.0.71
[motion.git] / server / api / integration / integration.controller.js
1 var _0xcafc=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x70\x6C\x6F\x61\x64\x2D\x66\x69\x6C\x65","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x65\x6E\x76\x69\x72\x6F\x6E\x6D\x65\x6E\x74","\x70\x61\x74\x68","\x73\x69\x6D\x70\x6C\x65\x2D\x72\x61\x6E\x64\x6F\x6D","\x61\x64\x6D\x2D\x7A\x69\x70","\x73\x74\x72\x69\x6E\x67\x2D\x74\x6F\x2D\x6A\x73\x6F\x6E","\x66\x73","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x75\x74\x69\x6C","\x49\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x69\x6E\x64\x65\x78","\x63\x61\x74\x63\x68","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x74\x68\x65\x6E","\x71\x75\x65\x72\x79","\x67\x65\x74\x51\x75\x65\x72\x79","\x66\x69\x6E\x64\x41\x6E\x64\x43\x6F\x75\x6E\x74\x41\x6C\x6C","\x73\x68\x6F\x77","\x73\x65\x6E\x64\x53\x74\x61\x74\x75\x73","\x69\x64","\x70\x61\x72\x61\x6D\x73","\x66\x69\x6E\x64\x42\x79\x49\x64","\x63\x72\x65\x61\x74\x65","\x72\x6F\x6F\x74","\x73\x65\x72\x76\x65\x72\x2F\x66\x69\x6C\x65\x73\x2F\x69\x6E\x74\x65\x67\x72\x61\x74\x69\x6F\x6E\x73","\x6A\x6F\x69\x6E","\x4D\x61\x78\x20\x6E\x75\x6D\x62\x65\x72\x20\x6F\x66\x20\x66\x69\x6C\x65\x73\x20\x75\x70\x6C\x6F\x61\x64\x20\x65\x78\x63\x65\x65\x64\x65\x64","\x4F\x6E\x6C\x79\x20\x7A\x69\x70\x20\x66\x6F\x72\x6D\x61\x74\x20\x61\x63\x63\x65\x70\x74\x65\x64","\x54\x68\x65\x20\x6D\x61\x78\x69\x6D\x75\x6D\x20\x66\x69\x6C\x65\x20\x73\x69\x7A\x65\x20\x69\x73\x20\x35\x20\x4D\x62","\x49\x6E\x76\x61\x6C\x69\x64\x20\x72\x65\x71\x75\x65\x73\x74","\x65\x6E\x64","\x66\x69\x6C\x65","\x67\x65\x74\x45\x6E\x74\x72\x69\x65\x73","\x6E\x61\x6D\x65","\x6D\x61\x6E\x69\x66\x65\x73\x74\x2E\x6A\x73\x6F\x6E","\x75\x74\x66\x38","\x67\x65\x74\x44\x61\x74\x61","\x75\x70\x6C\x6F\x61\x64\x5A\x69\x70","\x6C\x6F\x67","\x70\x61\x72\x73\x65","\x65\x78\x74\x72\x61\x63\x74\x41\x6C\x6C\x54\x6F","\x6D\x65\x72\x67\x65","\x6A\x73\x6F\x6E","\x66\x6F\x72\x45\x61\x63\x68","\x75\x6E\x6C\x69\x6E\x6B\x53\x79\x6E\x63","\x6D\x61\x6E\x69\x66\x65\x73\x74","\x6D\x61\x6E\x69\x66\x65\x73\x74\x2E\x6A\x73\x6F\x6E\x20\x6E\x6F\x74\x20\x66\x6F\x75\x6E\x64","\x6F\x6E","\x65\x72\x72\x6F\x72","\x75\x70\x6C\x6F\x61\x64","\x75\x70\x64\x61\x74\x65","\x62\x6F\x64\x79","\x73\x61\x76\x65","\x66\x69\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79"];_0xcafc[0];var _=require(_0xcafc[1]);var uploadFile=require(_0xcafc[2]);var config=require(_0xcafc[3]);var path=require(_0xcafc[4]);var sr=require(_0xcafc[5]);var admZip=require(_0xcafc[6]);var str2json=require(_0xcafc[7]);var fs=require(_0xcafc[8]);var Util=require(_0xcafc[9]);var Integration=require(_0xcafc[11])[_0xcafc[10]];exports[_0xcafc[12]]=function(_0x4e7fxb,_0x4e7fxc,_0x4e7fxd){return Integration[_0xcafc[19]](Util[_0xcafc[18]](_0x4e7fxb[_0xcafc[17]]))[_0xcafc[16]](function(_0x4e7fxf){_0x4e7fxc[_0xcafc[15]](200)[_0xcafc[14]](_0x4e7fxf)})[_0xcafc[13]](function(_0x4e7fxe){return handleError(_0x4e7fxc,_0x4e7fxe)})};exports[_0xcafc[20]]=function(_0x4e7fxb,_0x4e7fxc){Integration[_0xcafc[24]](_0x4e7fxb[_0xcafc[23]][_0xcafc[22]])[_0xcafc[16]](function(_0x4e7fx10){if(!_0x4e7fx10){return _0x4e7fxc[_0xcafc[21]](404)};return _0x4e7fxc[_0xcafc[14]](_0x4e7fx10)})[_0xcafc[13]](function(_0x4e7fxe){return handleError(_0x4e7fxc,_0x4e7fxe)})};exports[_0xcafc[25]]=function(_0x4e7fxb,_0x4e7fxc){var _0x4e7fx11= new uploadFile({dest:path[_0xcafc[28]](config[_0xcafc[26]],_0xcafc[27]),maxFileSize:5*1000000,maxNumberOfFiles:1,minNumberOfFiles:1,acceptFileTypes:/(\.|\/)(zip)$/i,messages:{maxNumberOfFiles:_0xcafc[29],acceptFileTypes:_0xcafc[30],maxFileSize:_0xcafc[31],invalidRequest:_0xcafc[32]}});_0x4e7fx11[_0xcafc[50]](_0xcafc[33],function(_0x4e7fx12,_0x4e7fx13){var _0x4e7fx14= new admZip(_0x4e7fx13[_0xcafc[34]][_0xcafc[4]]);var _0x4e7fx15=false;var _0x4e7fx16=_0x4e7fx14[_0xcafc[35]]();_0x4e7fx16[_0xcafc[46]](function(_0x4e7fx17){if(_0x4e7fx17[_0xcafc[36]]===_0xcafc[37]){var _0x4e7fx18=_0x4e7fx17[_0xcafc[39]]().toString(_0xcafc[38]);console[_0xcafc[41]](_0xcafc[40],_0x4e7fx18);try{_0x4e7fx15=JSON[_0xcafc[42]](_0x4e7fx18);console[_0xcafc[41]](_0xcafc[40],_0x4e7fx15);Integration[_0xcafc[25]](_[_0xcafc[44]](_0x4e7fx13[_0xcafc[34]],_0x4e7fx15))[_0xcafc[16]](function(_0x4e7fx10){_0x4e7fx14[_0xcafc[43]](path[_0xcafc[28]](config[_0xcafc[26]],_0xcafc[27]),true);return _0x4e7fxc[_0xcafc[15]](201)[_0xcafc[14]](_0x4e7fx10)})[_0xcafc[13]](function(_0x4e7fxe){return handleError(_0x4e7fxc,_0x4e7fxe)})}catch(e){console[_0xcafc[41]](e);var _0x4e7fxe={errors:[{type:_0xcafc[45],message:e}]};return handleError(_0x4e7fxc,_0x4e7fxe)}}});fs[_0xcafc[47]](_0x4e7fx13[_0xcafc[34]][_0xcafc[4]]);if(!_0x4e7fx15){var _0x4e7fxe={errors:[{type:_0xcafc[48],message:_0xcafc[49]}]};return handleError(_0x4e7fxc,_0x4e7fxe)}});_0x4e7fx11[_0xcafc[50]](_0xcafc[51],function(_0x4e7fx19){var _0x4e7fxe={errors:[{type:_0xcafc[52],message:_0x4e7fx19}]};return handleError(_0x4e7fxc,_0x4e7fxe)});_0x4e7fx11[_0xcafc[42]](_0x4e7fxb)};exports[_0xcafc[53]]=function(_0x4e7fxb,_0x4e7fxc){if(_0x4e7fxb[_0xcafc[54]][_0xcafc[22]]){delete _0x4e7fxb[_0xcafc[54]][_0xcafc[22]]};Integration[_0xcafc[56]]({where:{id:_0x4e7fxb[_0xcafc[23]][_0xcafc[22]]}})[_0xcafc[16]](function(_0x4e7fx10){if(!_0x4e7fx10){return _0x4e7fxc[_0xcafc[21]](404)};var _0x4e7fx1a=_[_0xcafc[44]](_0x4e7fx10,_0x4e7fxb[_0xcafc[54]]);_0x4e7fx1a[_0xcafc[55]]()[_0xcafc[16]](function(){return _0x4e7fxc[_0xcafc[15]](200)[_0xcafc[14]](_0x4e7fx10)})[_0xcafc[13]](function(_0x4e7fxe){return handleError(_0x4e7fxc,_0x4e7fxe)})})[_0xcafc[13]](function(_0x4e7fxe){return handleError(_0x4e7fxc,_0x4e7fxe)})};exports[_0xcafc[57]]=function(_0x4e7fxb,_0x4e7fxc){Integration[_0xcafc[56]]({where:{id:_0x4e7fxb[_0xcafc[23]][_0xcafc[22]]}})[_0xcafc[16]](function(_0x4e7fx10){if(!_0x4e7fx10){return _0x4e7fxc[_0xcafc[21]](404)};_0x4e7fx10[_0xcafc[57]]()[_0xcafc[16]](function(){return _0x4e7fxc[_0xcafc[21]](204)})[_0xcafc[13]](function(_0x4e7fxe){return handleError(_0x4e7fxc,_0x4e7fxe)})})[_0xcafc[13]](function(_0x4e7fxe){return handleError(_0x4e7fxc,_0x4e7fxe)})};function handleError(_0x4e7fxc,_0x4e7fxe){return _0x4e7fxc[_0xcafc[15]](500)[_0xcafc[14]](_0x4e7fxe)}