c7d7805360013709d55d747c2329785fc4010701
[motion.git] / server / api / action / action.controller.js
1 var _0xce39=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x41\x63\x74\x69\x6F\x6E","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x55\x73\x65\x72","\x73\x65\x71\x75\x65\x6C\x69\x7A\x65","\x62\x6C\x75\x65\x62\x69\x72\x64","\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","\x73\x74\x61\x63\x6B","\x65\x72\x72\x6F\x72","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x6A\x73\x6F\x6E","\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","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x72\x65\x61\x74\x65","\x55\x73\x65\x72\x49\x64","\x62\x6F\x64\x79","\x69\x64","\x75\x73\x65\x72","\x70\x61\x72\x61\x6D\x73","\x6D\x65\x72\x67\x65","\x63\x68\x61\x6E\x6E\x65\x6C","\x61\x6C\x6C","\x76\x6F\x69\x63\x65","\x69\x6E\x63\x6C\x75\x64\x65\x73","\x70\x61\x75\x73\x65","\x75\x6E\x70\x61\x75\x73\x65","\x6E\x61\x6D\x65","\x72\x65\x73\x6F\x6C\x76\x65","\x64\x61\x74\x61\x32","\x51\x75\x65\x75\x65\x50\x61\x75\x73\x65","\x71\x75\x65\x75\x65\x53\x74\x61\x74\x75\x73","\x25\x73\x2F\x25\x73","\x53\x49\x50","\x66\x6F\x72\x6D\x61\x74","\x74\x79\x70\x65","\x64\x61\x74\x61\x34","\x44\x45\x46\x41\x55\x4C\x54\x20\x50\x41\x55\x53\x45","\x61\x6D\x69","\x6C\x6F\x63\x61\x6C\x73","\x61\x70\x70","\x61\x67\x65\x6E\x74","\x66\x69\x6E\x64\x42\x79\x49\x64"];_0xce39[0];var _=require(_0xce39[1]);var Action=require(_0xce39[3])[_0xce39[2]];var User=require(_0xce39[3])[_0xce39[4]];var sequelize=require(_0xce39[3])[_0xce39[5]];var BPromise=require(_0xce39[6]);var util=require(_0xce39[7]);var logger=require(_0xce39[9])(_0xce39[8]);function handleError(_0xaf4ex9,_0xaf4exa){logger[_0xce39[11]](_0xaf4exa[_0xce39[10]]);return _0xaf4ex9[_0xce39[13]](500)[_0xce39[12]](_0xaf4exa)}function responseWithResult(_0xaf4ex9,_0xaf4exc){_0xaf4exc= _0xaf4exc|| 200;return function(_0xaf4exd){if(_0xaf4exd){_0xaf4ex9[_0xce39[13]](_0xaf4exc)[_0xce39[14]](_0xaf4exd)}}}function handleEntityNotFound(_0xaf4ex9){return function(_0xaf4exd){if(!_0xaf4exd){_0xaf4ex9[_0xce39[13]](404)[_0xce39[15]]();return null};return _0xaf4exd}}function saveUpdates(_0xaf4ex10){return function(_0xaf4exd){return _0xaf4exd[_0xce39[17]](_0xaf4ex10)[_0xce39[16]](function(_0xaf4ex11){return _0xaf4ex11})}}function removeEntity(_0xaf4ex9){return function(_0xaf4exd){if(_0xaf4exd){return _0xaf4exd[_0xce39[18]]()[_0xce39[16]](function(){_0xaf4ex9[_0xce39[13]](204)[_0xce39[15]]()})}}}exports[_0xce39[19]]= function(_0xaf4ex13,_0xaf4ex9){return Action[_0xce39[21]]()[_0xce39[16]](responseWithResult(_0xaf4ex9))[_0xce39[20]](function(_0xaf4exa){handleError(_0xaf4ex9,_0xaf4exa)})};exports[_0xce39[22]]= function(_0xaf4ex13,_0xaf4ex9,_0xaf4ex14){_0xaf4ex13[_0xce39[24]][_0xce39[23]]= _0xaf4ex13[_0xce39[26]][_0xce39[25]];_[_0xce39[28]](_0xaf4ex13[_0xce39[24]],_0xaf4ex13[_0xce39[27]]);return BPromise[_0xce39[36]]()[_0xce39[16]](function(){if(!_0xaf4ex13[_0xce39[24]][_0xce39[29]]|| _[_0xce39[32]]([_0xce39[30],_0xce39[31]],_0xaf4ex13[_0xce39[24]][_0xce39[29]])){switch(_0xaf4ex13[_0xce39[24]][_0xce39[35]]){case _0xce39[33]:;case _0xce39[34]:return sendAction(_0xaf4ex13,_0xaf4ex9);default:return null}};return null})[_0xce39[16]](function(){return Action[_0xce39[22]](_0xaf4ex13[_0xce39[24]],{body:_0xaf4ex13[_0xce39[24]]})})[_0xce39[16]](function(_0xaf4ex15){return _0xaf4ex9[_0xce39[13]](201)[_0xce39[12]](_0xaf4ex15)})[_0xce39[20]](function(_0xaf4exa){return handleError(_0xaf4ex9,_0xaf4exa)})};function sendAction(_0xaf4ex13,_0xaf4ex9){return BPromise[_0xce39[36]]()[_0xce39[16]](function(){return User[_0xce39[50]](_0xaf4ex13[_0xce39[24]][_0xce39[49]])})[_0xce39[16]](function(_0xaf4ex17){if(!_0xaf4ex17){_0xaf4ex9[_0xce39[13]](404)[_0xce39[15]]();return null};_0xaf4ex13[_0xce39[24]][_0xce39[37]]= _0xaf4ex17[_0xce39[35]];var _0xaf4ex15;switch(_0xaf4ex13[_0xce39[24]][_0xce39[35]]){case _0xce39[33]:_0xaf4ex15= {message:_0xce39[38],agent:_0xaf4ex13[_0xce39[24]][_0xce39[37]],queueStatus:_0xaf4ex17[_0xce39[39]],action:{action:_0xce39[38],interface:util[_0xce39[42]](_0xce39[40],_0xce39[41],_0xaf4ex13[_0xce39[24]][_0xce39[37]]),paused:true,reason:_0xaf4ex13[_0xce39[24]][_0xce39[43]]|| _0xaf4ex13[_0xce39[24]][_0xce39[44]]|| _0xce39[45]}};break;case _0xce39[34]:_0xaf4ex15= {message:_0xce39[38],agent:_0xaf4ex13[_0xce39[24]][_0xce39[37]],queueStatus:_0xaf4ex17[_0xce39[39]],action:{action:_0xce39[38],interface:util[_0xce39[42]](_0xce39[40],_0xce39[41],_0xaf4ex13[_0xce39[24]][_0xce39[37]]),paused:false}};break;default:};if(_0xaf4ex15){return _0xaf4ex13[_0xce39[48]][_0xce39[47]][_0xce39[46]][_0xce39[12]](_0xaf4ex15)};return null})}