3a9509cf845412fd41d89fbc7d795278bc2aefc3
[motion.git] / server / api / integration / integration.controller.js
1 var _0xf233=["\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","\x61\x70\x69","\x2E\x2E\x2F\x2E\x2E\x2F\x63\x6F\x6E\x66\x69\x67\x2F\x6C\x6F\x67\x67\x65\x72\x2E\x6A\x73","\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","\x64\x65\x62\x75\x67","\x70\x61\x72\x73\x65","\x65\x78\x74\x72\x61\x63\x74\x41\x6C\x6C\x54\x6F","\x6D\x65\x72\x67\x65","\x65\x72\x72\x6F\x72","\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","\x75\x70\x6C\x6F\x61\x64","\x75\x70\x64\x61\x74\x65","\x62\x6F\x64\x79","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x66\x69\x6E\x64","\x73\x74\x61\x63\x6B"];_0xf233[0];var _=require(_0xf233[1]);var uploadFile=require(_0xf233[2]);var config=require(_0xf233[3]);var path=require(_0xf233[4]);var sr=require(_0xf233[5]);var admZip=require(_0xf233[6]);var str2json=require(_0xf233[7]);var fs=require(_0xf233[8]);var Util=require(_0xf233[9]);var logger=require(_0xf233[11])(_0xf233[10]);var Integration=require(_0xf233[13])[_0xf233[12]];exports[_0xf233[14]]= function(_0x9422xc,_0x9422xd,_0x9422xe){return Integration[_0xf233[21]](Util[_0xf233[20]](_0x9422xc[_0xf233[19]]))[_0xf233[18]](function(_0x9422x10){_0x9422xd[_0xf233[17]](200)[_0xf233[16]](_0x9422x10)})[_0xf233[15]](function(_0x9422xf){return handleError(_0x9422xd,_0x9422xf)})};exports[_0xf233[22]]= function(_0x9422xc,_0x9422xd){return Integration[_0xf233[26]](_0x9422xc[_0xf233[25]][_0xf233[24]])[_0xf233[18]](function(_0x9422x11){if(!_0x9422x11){return _0x9422xd[_0xf233[23]](404)};return _0x9422xd[_0xf233[16]](_0x9422x11)})[_0xf233[15]](function(_0x9422xf){return handleError(_0x9422xd,_0x9422xf)})};exports[_0xf233[27]]= function(_0x9422xc,_0x9422xd){var _0x9422x12= new uploadFile({dest:path[_0xf233[30]](config[_0xf233[28]],_0xf233[29]),maxFileSize:5* 1000000,maxNumberOfFiles:1,minNumberOfFiles:1,acceptFileTypes:/(\.|\/)(zip)$/i,messages:{maxNumberOfFiles:_0xf233[31],acceptFileTypes:_0xf233[32],maxFileSize:_0xf233[33],invalidRequest:_0xf233[34]}});_0x9422x12[_0xf233[53]](_0xf233[35],function(_0x9422x13,_0x9422x14){var _0x9422x15= new admZip(_0x9422x14[_0xf233[36]][_0xf233[4]]);var _0x9422x16=false;var _0x9422x17=_0x9422x15[_0xf233[37]]();_0x9422x17[_0xf233[49]](function(_0x9422x18){if(_0x9422x18[_0xf233[38]]=== _0xf233[39]){var _0x9422x19=_0x9422x18[_0xf233[41]]().toString(_0xf233[40]);logger[_0xf233[43]](_0xf233[42],_0x9422x19);try{_0x9422x16= JSON[_0xf233[44]](_0x9422x19);logger[_0xf233[43]](_0xf233[42],_0x9422x16);Integration[_0xf233[27]](_[_0xf233[46]](_0x9422x14[_0xf233[36]],_0x9422x16))[_0xf233[18]](function(_0x9422x11){_0x9422x15[_0xf233[45]](path[_0xf233[30]](config[_0xf233[28]],_0xf233[29]),true);return _0x9422xd[_0xf233[17]](201)[_0xf233[16]](_0x9422x11)})[_0xf233[15]](function(_0x9422xf){return handleError(_0x9422xd,_0x9422xf)})}catch(e){logger[_0xf233[47]](e);var _0x9422xf={errors:[{type:_0xf233[48],message:e}]};return handleError(_0x9422xd,_0x9422xf)}}});fs[_0xf233[50]](_0x9422x14[_0xf233[36]][_0xf233[4]]);if(!_0x9422x16){var _0x9422xf={errors:[{type:_0xf233[51],message:_0xf233[52]}]};return handleError(_0x9422xd,_0x9422xf)}});_0x9422x12[_0xf233[53]](_0xf233[47],function(_0x9422x1a){var _0x9422xf={errors:[{type:_0xf233[54],message:_0x9422x1a}]};return handleError(_0x9422xd,_0x9422xf)});_0x9422x12[_0xf233[44]](_0x9422xc)};exports[_0xf233[55]]= function(_0x9422xc,_0x9422xd){if(_0x9422xc[_0xf233[56]][_0xf233[24]]){delete _0x9422xc[_0xf233[56]][_0xf233[24]]};return Integration[_0xf233[26]](_0x9422xc[_0xf233[25]][_0xf233[24]])[_0xf233[18]](function(_0x9422x11){if(!_0x9422x11){return _0x9422xd[_0xf233[23]](404)};var _0x9422x1b=_[_0xf233[46]](_0x9422x11,_0x9422xc[_0xf233[56]]);return _0x9422x1b[_0xf233[57]]()})[_0xf233[18]](function(_0x9422x11){return _0x9422xd[_0xf233[17]](200)[_0xf233[16]](_0x9422x11)})[_0xf233[15]](function(_0x9422xf){return handleError(_0x9422xd,_0x9422xf)})};exports[_0xf233[58]]= function(_0x9422xc,_0x9422xd){return Integration[_0xf233[59]]({where:{id:_0x9422xc[_0xf233[25]][_0xf233[24]]}})[_0xf233[18]](function(_0x9422x11){if(!_0x9422x11){return _0x9422xd[_0xf233[23]](404)};return _0x9422x11[_0xf233[58]]()})[_0xf233[18]](function(){return _0x9422xd[_0xf233[23]](204)})[_0xf233[15]](function(_0x9422xf){return handleError(_0x9422xd,_0x9422xf)})};function handleError(_0x9422xd,_0x9422xf){logger[_0xf233[47]](_0x9422xf[_0xf233[60]]);return _0x9422xd[_0xf233[17]](500)[_0xf233[16]](_0x9422xf)}