Built motion from commit 366410c.|0.0.27
[motion.git] / server / api / agent / agent.controller.js
1 var _0xf659=["\x75\x73\x65\x20\x73\x74\x72\x69\x63\x74","\x6C\x6F\x64\x61\x73\x68","\x75\x74\x69\x6C","\x55\x73\x65\x72","\x2E\x2E\x2F\x2E\x2E\x2F\x6D\x6F\x64\x65\x6C\x73","\x54\x65\x61\x6D","\x69\x6E\x64\x65\x78","\x66\x75\x6C\x6C\x6E\x61\x6D\x65","\x6E\x61\x6D\x65","\x65\x6D\x61\x69\x6C","\x70\x65\x72\x5F\x70\x61\x67\x65","\x71\x75\x65\x72\x79","\x70\x61\x67\x65","\x61\x67\x65\x6E\x74","\x6F\x72\x64\x65\x72","\x25\x73\x20\x25\x73","\x73\x6F\x72\x74\x5F\x62\x79","\x73\x6F\x72\x74\x5F\x6F\x72\x64\x65\x72","\x41\x53\x43","\x66\x6F\x72\x6D\x61\x74","\x24\x6F\x72","\x77\x68\x65\x72\x65","\x25","\x70\x75\x73\x68","\x66\x6F\x72\x45\x61\x63\x68","\x24","\x24\x6C\x69\x6B\x65","\x66\x6F\x72\x49\x6E","\x53\x6F\x6D\x65\x74\x68\x69\x6E\x67\x20\x62\x6C\x65\x77\x20\x75\x70\x21","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\x73","\x63\x61\x74\x63\x68","\x63\x6F\x75\x6E\x74","\x63\x65\x69\x6C","\x6F\x66\x66\x73\x65\x74","\x25\x73\x3A\x2F\x2F\x25\x73\x25\x73\x3F\x70\x61\x67\x65\x3D\x25\x64","\x70\x72\x6F\x74\x6F\x63\x6F\x6C","\x68\x6F\x73\x74","\x68\x65\x61\x64\x65\x72\x73","\x62\x61\x73\x65\x55\x72\x6C","\x72\x6F\x77\x73","\x74\x68\x65\x6E","\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","\x69\x6E\x74\x65\x72\x6E\x61\x6C\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x69\x6E\x74\x65\x72\x6E\x61\x6C","\x62\x6F\x64\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x72\x65\x61\x74\x65","\x6C\x6F\x67","\x61\x64\x64\x55\x73\x65\x72","\x66\x69\x6E\x64\x4F\x6E\x65","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x64\x65\x73\x74\x72\x6F\x79","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x63\x68\x61\x6E\x67\x65\x50\x61\x73\x73\x77\x6F\x72\x64","\x75\x73\x65\x72","\x6F\x6C\x64\x50\x61\x73\x73\x77\x6F\x72\x64","\x6E\x65\x77\x50\x61\x73\x73\x77\x6F\x72\x64","\x61\x75\x74\x68\x65\x6E\x74\x69\x63\x61\x74\x65","\x70\x61\x73\x73\x77\x6F\x72\x64","\x72\x65\x73\x65\x74\x50\x61\x73\x73\x77\x6F\x72\x64","\x61\x67\x65\x6E\x74\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x66\x69\x65\x6C\x64","\x76\x61\x6C\x75\x65"];_0xf659[0];var _=require(_0xf659[1]);var util=require(_0xf659[2]);var Agent=require(_0xf659[4])[_0xf659[3]];var Team=require(_0xf659[4])[_0xf659[5]];exports[_0xf659[6]]=function(_0x1b23x5,_0x1b23x6,_0x1b23x7){var _0x1b23x8=[_0xf659[7],_0xf659[8],_0xf659[9]];var _0x1b23x9=_0x1b23x5[_0xf659[11]][_0xf659[10]]?parseInt(_0x1b23x5[_0xf659[11]][_0xf659[10]],10):100;var _0x1b23xa=_0x1b23x5[_0xf659[11]][_0xf659[12]]?parseInt(_0x1b23x5[_0xf659[11]][_0xf659[12]],10):0;var _0x1b23xb={where:{role:_0xf659[13]},limit:_0x1b23x9,offset:_0x1b23xa*_0x1b23x9};_[_0xf659[27]](_0x1b23x5[_0xf659[11]],function(_0x1b23xc,_0x1b23xd){switch(_0x1b23xd){case _0xf659[10]:;case _0xf659[12]:break ;;case _0xf659[16]:_0x1b23xb[_0xf659[14]]=util[_0xf659[19]](_0xf659[15],_0x1b23x5[_0xf659[11]][_0xf659[16]],_0x1b23x5[_0xf659[11]][_0xf659[17]]||_0xf659[18])||null;break ;;case _0xf659[17]:break ;;case _0xf659[25]:_0x1b23xb[_0xf659[21]][_0xf659[20]]=[];_0x1b23x8[_0xf659[24]](function(_0x1b23xe){var _0x1b23xf={};_0x1b23xf[_0x1b23xe]={$like:_0xf659[22]+_0x1b23xc+_0xf659[22]};_0x1b23xb[_0xf659[21]][_0xf659[20]][_0xf659[23]](_0x1b23xf);});break ;;default:_0x1b23xb[_0xf659[21]][_0x1b23xd]={$like:{}};_0x1b23xb[_0xf659[21]][_0x1b23xd][_0xf659[26]]=_0xf659[22]+_0x1b23xc+_0xf659[22];;}});Agent[_0xf659[42]](_0x1b23xb)[_0xf659[41]](function(_0x1b23x11){var _0x1b23x12=Math[_0xf659[33]](_0x1b23x11[_0xf659[32]]/_0x1b23x9);var _0x1b23x13=_0x1b23x12>(_0x1b23xb[_0xf659[34]]+1)?util[_0xf659[19]](_0xf659[35],_0x1b23x5[_0xf659[36]],_0x1b23x5[_0xf659[38]][_0xf659[37]],_0x1b23x5[_0xf659[39]],_0x1b23xa+1):null;var _0x1b23x14=_0x1b23xa>0?util[_0xf659[19]](_0xf659[35],_0x1b23x5[_0xf659[36]],_0x1b23x5[_0xf659[38]][_0xf659[37]],_0x1b23x5[_0xf659[39]],_0x1b23xa-1):null;_0x1b23x6[_0xf659[30]](200)[_0xf659[29]]({count:_0x1b23x11[_0xf659[32]],rows:_0x1b23x11[_0xf659[40]],next_page:_0x1b23x13,previous_page:_0x1b23x14,total_pages:_0x1b23x12});})[_0xf659[31]](function(_0x1b23x10){_0x1b23x6[_0xf659[30]](500)[_0xf659[29]]({error:_0xf659[28]})});};exports[_0xf659[43]]=function(_0x1b23x5,_0x1b23x6){Agent[_0xf659[47]](_0x1b23x5[_0xf659[46]][_0xf659[45]])[_0xf659[41]](function(_0x1b23x15){if(!_0x1b23x15){return _0x1b23x6[_0xf659[44]](404)};return _0x1b23x6[_0xf659[29]](_0x1b23x15);})[_0xf659[31]](function(_0x1b23x10){return handleError(_0x1b23x6,_0x1b23x10)})};exports[_0xf659[48]]=function(_0x1b23x5,_0x1b23x6){Agent[_0xf659[51]]({where:{internal:_0x1b23x5[_0xf659[50]][_0xf659[49]]}})[_0xf659[41]](function(_0x1b23x16){if(!_0x1b23x16){return _0x1b23x6[_0xf659[44]](404)};return _0x1b23x6[_0xf659[29]](_0x1b23x16);})[_0xf659[31]](function(_0x1b23x10){return handleError(_0x1b23x6,_0x1b23x10)})};exports[_0xf659[52]]=function(_0x1b23x5,_0x1b23x6){Agent[_0xf659[52]](_0x1b23x5[_0xf659[50]])[_0xf659[41]](function(_0x1b23x15){Team[_0xf659[55]]({where:{defaultEntry:true}})[_0xf659[41]](function(_0x1b23x17){_0x1b23x17[_0xf659[54]](_0x1b23x15[_0xf659[45]])[_0xf659[41]](function(){return _0x1b23x6[_0xf659[30]](201)[_0xf659[29]](_0x1b23x15)})[_0xf659[31]](function(_0x1b23x10){console[_0xf659[53]](_0x1b23x10);return handleError(_0x1b23x6,_0x1b23x10);})})[_0xf659[31]](function(_0x1b23x10){console[_0xf659[53]](_0x1b23x10);return handleError(_0x1b23x6,_0x1b23x10);})})[_0xf659[31]](function(_0x1b23x10){console[_0xf659[53]](_0x1b23x10);return handleError(_0x1b23x6,_0x1b23x10);})};exports[_0xf659[56]]=function(_0x1b23x5,_0x1b23x6){if(_0x1b23x5[_0xf659[50]][_0xf659[45]]){delete _0x1b23x5[_0xf659[50]][_0xf659[45]]};Agent[_0xf659[47]](_0x1b23x5[_0xf659[46]][_0xf659[45]])[_0xf659[41]](function(_0x1b23x15){if(!_0x1b23x15){return _0x1b23x6[_0xf659[44]](404)};var _0x1b23x18=_[_0xf659[57]](_0x1b23x15,_0x1b23x5[_0xf659[50]]);_0x1b23x18[_0xf659[58]]()[_0xf659[41]](function(){return _0x1b23x6[_0xf659[30]](200)[_0xf659[29]](_0x1b23x15)})[_0xf659[31]](function(_0x1b23x10){return handleError(_0x1b23x6,_0x1b23x10)});})[_0xf659[31]](function(_0x1b23x10){return handleError(_0x1b23x6,_0x1b23x10)});};exports[_0xf659[59]]=function(_0x1b23x5,_0x1b23x6){Agent[_0xf659[47]](_0x1b23x5[_0xf659[46]][_0xf659[45]])[_0xf659[41]](function(_0x1b23x15){if(!_0x1b23x15){return _0x1b23x6[_0xf659[44]](404)};_0x1b23x15[_0xf659[59]]()[_0xf659[41]](function(){return _0x1b23x6[_0xf659[44]](204)})[_0xf659[31]](function(_0x1b23x10){return handleError(_0x1b23x6,_0x1b23x10)});})[_0xf659[31]](function(_0x1b23x10){return handleError(_0x1b23x6,_0x1b23x10)})};exports[_0xf659[60]]=function(_0x1b23x5,_0x1b23x6){Agent[_0xf659[59]]({where:{id:_0x1b23x5[_0xf659[11]][_0xf659[45]]},individualHooks:true})[_0xf659[41]](function(){return _0x1b23x6[_0xf659[44]](204)})[_0xf659[31]](function(_0x1b23x10){return handleError(_0x1b23x6,_0x1b23x10)})};exports[_0xf659[61]]=function(_0x1b23x5,_0x1b23x6,_0x1b23x7){console[_0xf659[53]](_0x1b23x5[_0xf659[50]]);var _0x1b23x19=_0x1b23x5[_0xf659[62]][_0xf659[45]];var _0x1b23x1a=String(_0x1b23x5[_0xf659[50]][_0xf659[63]]);var _0x1b23x1b=String(_0x1b23x5[_0xf659[50]][_0xf659[64]]);Agent[_0xf659[47]](_0x1b23x19)[_0xf659[41]](function(_0x1b23x15){if(_0x1b23x15[_0xf659[65]](_0x1b23x1a)){_0x1b23x15[_0xf659[66]]=_0x1b23x1b;_0x1b23x15[_0xf659[58]]()[_0xf659[41]](function(){_0x1b23x6[_0xf659[30]](200)[_0xf659[29]](_0x1b23x15)})[_0xf659[31]](function(_0x1b23x10){return _0x1b23x7(_0x1b23x10)});}else {_0x1b23x6[_0xf659[44]](403)}});};exports[_0xf659[67]]=function(_0x1b23x5,_0x1b23x6,_0x1b23x7){var _0x1b23x1b=String(_0x1b23x5[_0xf659[50]][_0xf659[64]]);Agent[_0xf659[47]](_0x1b23x5[_0xf659[46]][_0xf659[45]])[_0xf659[41]](function(_0x1b23x1c){_0x1b23x1c[_0xf659[66]]=_0x1b23x1b;_0x1b23x1c[_0xf659[58]]()[_0xf659[41]](function(){_0x1b23x6[_0xf659[30]](200)[_0xf659[29]](_0x1b23x1c)})[_0xf659[31]](function(_0x1b23x10){return handleError(_0x1b23x6,_0x1b23x10)});});};exports[_0xf659[68]]=function(_0x1b23x5,_0x1b23x6){var _0x1b23x1d={};_0x1b23x1d[_0x1b23x5[_0xf659[46]][_0xf659[69]]]=_0x1b23x5[_0xf659[50]][_0xf659[70]];Agent[_0xf659[42]]({where:_0x1b23x1d})[_0xf659[41]](function(_0x1b23x11){if(_0x1b23x11[_0xf659[32]]){return _0x1b23x6[_0xf659[30]](200)[_0xf659[29]]({isValid:false,value:_0x1b23x5[_0xf659[50]][_0xf659[70]]})};return _0x1b23x6[_0xf659[30]](200)[_0xf659[29]]({isValid:true,value:_0x1b23x5[_0xf659[50]][_0xf659[70]]});})[_0xf659[31]](function(_0x1b23x10){return handleError(_0x1b23x6,_0x1b23x10)});};function handleError(_0x1b23x6,_0x1b23x10){return _0x1b23x6[_0xf659[30]](500)[_0xf659[29]](_0x1b23x10)}