Built motion from commit 0ad9c269e.|1.0.31
[motion.git] / server / api / action / action.controller.js
index f4dc212..67eac23 100644 (file)
@@ -1 +1 @@
-var _0xd6c5=["\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"];_0xd6c5[0];var _=require(_0xd6c5[1]);var Action=require(_0xd6c5[3])[_0xd6c5[2]];var User=require(_0xd6c5[3])[_0xd6c5[4]];var sequelize=require(_0xd6c5[3])[_0xd6c5[5]];var BPromise=require(_0xd6c5[6]);var util=require(_0xd6c5[7]);var logger=require(_0xd6c5[9])(_0xd6c5[8]);function handleError(_0xad10x9,_0xad10xa){logger[_0xd6c5[11]](_0xad10xa[_0xd6c5[10]]);return _0xad10x9[_0xd6c5[13]](500)[_0xd6c5[12]](_0xad10xa)}function responseWithResult(_0xad10x9,_0xad10xc){_0xad10xc= _0xad10xc|| 200;return function(_0xad10xd){if(_0xad10xd){_0xad10x9[_0xd6c5[13]](_0xad10xc)[_0xd6c5[14]](_0xad10xd)}}}function handleEntityNotFound(_0xad10x9){return function(_0xad10xd){if(!_0xad10xd){_0xad10x9[_0xd6c5[13]](404)[_0xd6c5[15]]();return null};return _0xad10xd}}function saveUpdates(_0xad10x10){return function(_0xad10xd){return _0xad10xd[_0xd6c5[17]](_0xad10x10)[_0xd6c5[16]](function(_0xad10x11){return _0xad10x11})}}function removeEntity(_0xad10x9){return function(_0xad10xd){if(_0xad10xd){return _0xad10xd[_0xd6c5[18]]()[_0xd6c5[16]](function(){_0xad10x9[_0xd6c5[13]](204)[_0xd6c5[15]]()})}}}exports[_0xd6c5[19]]= function(_0xad10x13,_0xad10x9){return Action[_0xd6c5[21]]()[_0xd6c5[16]](responseWithResult(_0xad10x9))[_0xd6c5[20]](function(_0xad10xa){handleError(_0xad10x9,_0xad10xa)})};exports[_0xd6c5[22]]= function(_0xad10x13,_0xad10x9,_0xad10x14){_0xad10x13[_0xd6c5[24]][_0xd6c5[23]]= _0xad10x13[_0xd6c5[26]][_0xd6c5[25]];_[_0xd6c5[28]](_0xad10x13[_0xd6c5[24]],_0xad10x13[_0xd6c5[27]]);return BPromise[_0xd6c5[36]]()[_0xd6c5[16]](function(){if(!_0xad10x13[_0xd6c5[24]][_0xd6c5[29]]|| _[_0xd6c5[32]]([_0xd6c5[30],_0xd6c5[31]],_0xad10x13[_0xd6c5[24]][_0xd6c5[29]])){switch(_0xad10x13[_0xd6c5[24]][_0xd6c5[35]]){case _0xd6c5[33]:;case _0xd6c5[34]:return sendAction(_0xad10x13,_0xad10x9);default:return null}};return null})[_0xd6c5[16]](function(){return Action[_0xd6c5[22]](_0xad10x13[_0xd6c5[24]],{body:_0xad10x13[_0xd6c5[24]]})})[_0xd6c5[16]](function(_0xad10x15){return _0xad10x9[_0xd6c5[13]](201)[_0xd6c5[12]](_0xad10x15)})[_0xd6c5[20]](function(_0xad10xa){return handleError(_0xad10x9,_0xad10xa)})};function sendAction(_0xad10x13,_0xad10x9){return BPromise[_0xd6c5[36]]()[_0xd6c5[16]](function(){return User[_0xd6c5[50]](_0xad10x13[_0xd6c5[24]][_0xd6c5[49]])})[_0xd6c5[16]](function(_0xad10x17){if(!_0xad10x17){_0xad10x9[_0xd6c5[13]](404)[_0xd6c5[15]]();return null};_0xad10x13[_0xd6c5[24]][_0xd6c5[37]]= _0xad10x17[_0xd6c5[35]];var _0xad10x15;switch(_0xad10x13[_0xd6c5[24]][_0xd6c5[35]]){case _0xd6c5[33]:_0xad10x15= {message:_0xd6c5[38],agent:_0xad10x13[_0xd6c5[24]][_0xd6c5[37]],queueStatus:_0xad10x17[_0xd6c5[39]],action:{action:_0xd6c5[38],interface:util[_0xd6c5[42]](_0xd6c5[40],_0xd6c5[41],_0xad10x13[_0xd6c5[24]][_0xd6c5[37]]),paused:true,reason:_0xad10x13[_0xd6c5[24]][_0xd6c5[43]]|| _0xad10x13[_0xd6c5[24]][_0xd6c5[44]]|| _0xd6c5[45]}};break;case _0xd6c5[34]:_0xad10x15= {message:_0xd6c5[38],agent:_0xad10x13[_0xd6c5[24]][_0xd6c5[37]],queueStatus:_0xad10x17[_0xd6c5[39]],action:{action:_0xd6c5[38],interface:util[_0xd6c5[42]](_0xd6c5[40],_0xd6c5[41],_0xad10x13[_0xd6c5[24]][_0xd6c5[37]]),paused:false}};break;default:};if(_0xad10x15){return _0xad10x13[_0xd6c5[48]][_0xd6c5[47]][_0xd6c5[46]][_0xd6c5[12]](_0xad10x15)};return null})}
\ No newline at end of file
+var _0x35d6=["\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"];_0x35d6[0];var _=require(_0x35d6[1]);var Action=require(_0x35d6[3])[_0x35d6[2]];var User=require(_0x35d6[3])[_0x35d6[4]];var sequelize=require(_0x35d6[3])[_0x35d6[5]];var BPromise=require(_0x35d6[6]);var util=require(_0x35d6[7]);var logger=require(_0x35d6[9])(_0x35d6[8]);function handleError(_0x6fb5x9,_0x6fb5xa){logger[_0x35d6[11]](_0x6fb5xa[_0x35d6[10]]);return _0x6fb5x9[_0x35d6[13]](500)[_0x35d6[12]](_0x6fb5xa)}function responseWithResult(_0x6fb5x9,_0x6fb5xc){_0x6fb5xc= _0x6fb5xc|| 200;return function(_0x6fb5xd){if(_0x6fb5xd){_0x6fb5x9[_0x35d6[13]](_0x6fb5xc)[_0x35d6[14]](_0x6fb5xd)}}}function handleEntityNotFound(_0x6fb5x9){return function(_0x6fb5xd){if(!_0x6fb5xd){_0x6fb5x9[_0x35d6[13]](404)[_0x35d6[15]]();return null};return _0x6fb5xd}}function saveUpdates(_0x6fb5x10){return function(_0x6fb5xd){return _0x6fb5xd[_0x35d6[17]](_0x6fb5x10)[_0x35d6[16]](function(_0x6fb5x11){return _0x6fb5x11})}}function removeEntity(_0x6fb5x9){return function(_0x6fb5xd){if(_0x6fb5xd){return _0x6fb5xd[_0x35d6[18]]()[_0x35d6[16]](function(){_0x6fb5x9[_0x35d6[13]](204)[_0x35d6[15]]()})}}}exports[_0x35d6[19]]= function(_0x6fb5x13,_0x6fb5x9){return Action[_0x35d6[21]]()[_0x35d6[16]](responseWithResult(_0x6fb5x9))[_0x35d6[20]](function(_0x6fb5xa){handleError(_0x6fb5x9,_0x6fb5xa)})};exports[_0x35d6[22]]= function(_0x6fb5x13,_0x6fb5x9,_0x6fb5x14){_0x6fb5x13[_0x35d6[24]][_0x35d6[23]]= _0x6fb5x13[_0x35d6[26]][_0x35d6[25]];_[_0x35d6[28]](_0x6fb5x13[_0x35d6[24]],_0x6fb5x13[_0x35d6[27]]);return BPromise[_0x35d6[36]]()[_0x35d6[16]](function(){if(!_0x6fb5x13[_0x35d6[24]][_0x35d6[29]]|| _[_0x35d6[32]]([_0x35d6[30],_0x35d6[31]],_0x6fb5x13[_0x35d6[24]][_0x35d6[29]])){switch(_0x6fb5x13[_0x35d6[24]][_0x35d6[35]]){case _0x35d6[33]:;case _0x35d6[34]:return sendAction(_0x6fb5x13,_0x6fb5x9);default:return null}};return null})[_0x35d6[16]](function(){return Action[_0x35d6[22]](_0x6fb5x13[_0x35d6[24]],{body:_0x6fb5x13[_0x35d6[24]]})})[_0x35d6[16]](function(_0x6fb5x15){return _0x6fb5x9[_0x35d6[13]](201)[_0x35d6[12]](_0x6fb5x15)})[_0x35d6[20]](function(_0x6fb5xa){return handleError(_0x6fb5x9,_0x6fb5xa)})};function sendAction(_0x6fb5x13,_0x6fb5x9){return BPromise[_0x35d6[36]]()[_0x35d6[16]](function(){return User[_0x35d6[50]](_0x6fb5x13[_0x35d6[24]][_0x35d6[49]])})[_0x35d6[16]](function(_0x6fb5x17){if(!_0x6fb5x17){_0x6fb5x9[_0x35d6[13]](404)[_0x35d6[15]]();return null};_0x6fb5x13[_0x35d6[24]][_0x35d6[37]]= _0x6fb5x17[_0x35d6[35]];var _0x6fb5x15;switch(_0x6fb5x13[_0x35d6[24]][_0x35d6[35]]){case _0x35d6[33]:_0x6fb5x15= {message:_0x35d6[38],agent:_0x6fb5x13[_0x35d6[24]][_0x35d6[37]],queueStatus:_0x6fb5x17[_0x35d6[39]],action:{action:_0x35d6[38],interface:util[_0x35d6[42]](_0x35d6[40],_0x35d6[41],_0x6fb5x13[_0x35d6[24]][_0x35d6[37]]),paused:true,reason:_0x6fb5x13[_0x35d6[24]][_0x35d6[43]]|| _0x6fb5x13[_0x35d6[24]][_0x35d6[44]]|| _0x35d6[45]}};break;case _0x35d6[34]:_0x6fb5x15= {message:_0x35d6[38],agent:_0x6fb5x13[_0x35d6[24]][_0x35d6[37]],queueStatus:_0x6fb5x17[_0x35d6[39]],action:{action:_0x35d6[38],interface:util[_0x35d6[42]](_0x35d6[40],_0x35d6[41],_0x6fb5x13[_0x35d6[24]][_0x35d6[37]]),paused:false}};break;default:};if(_0x6fb5x15){return _0x6fb5x13[_0x35d6[48]][_0x35d6[47]][_0x35d6[46]][_0x35d6[12]](_0x6fb5x15)};return null})}
\ No newline at end of file