Built motion from commit 1b16498.|0.0.35
[motion.git] / server / api / agent / agent.controller.js
1 var _0x465f=["\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"];_0x465f[0];var _=require(_0x465f[1]);var util=require(_0x465f[2]);var Agent=require(_0x465f[4])[_0x465f[3]];var Team=require(_0x465f[4])[_0x465f[5]];exports[_0x465f[6]]=function(_0x291ax5,_0x291ax6,_0x291ax7){var _0x291ax8=[_0x465f[7],_0x465f[8],_0x465f[9]];var _0x291ax9=_0x291ax5[_0x465f[11]][_0x465f[10]]?parseInt(_0x291ax5[_0x465f[11]][_0x465f[10]],10):100;var _0x291axa=_0x291ax5[_0x465f[11]][_0x465f[12]]?parseInt(_0x291ax5[_0x465f[11]][_0x465f[12]],10):0;var _0x291axb={where:{role:_0x465f[13]},limit:_0x291ax9,offset:_0x291axa*_0x291ax9};_[_0x465f[27]](_0x291ax5[_0x465f[11]],function(_0x291axc,_0x291axd){switch(_0x291axd){case _0x465f[10]:;case _0x465f[12]:break ;;case _0x465f[16]:_0x291axb[_0x465f[14]]=util[_0x465f[19]](_0x465f[15],_0x291ax5[_0x465f[11]][_0x465f[16]],_0x291ax5[_0x465f[11]][_0x465f[17]]||_0x465f[18])||null;break ;;case _0x465f[17]:break ;;case _0x465f[25]:_0x291axb[_0x465f[21]][_0x465f[20]]=[];_0x291ax8[_0x465f[24]](function(_0x291axe){var _0x291axf={};_0x291axf[_0x291axe]={$like:_0x465f[22]+_0x291axc+_0x465f[22]};_0x291axb[_0x465f[21]][_0x465f[20]][_0x465f[23]](_0x291axf);});break ;;default:_0x291axb[_0x465f[21]][_0x291axd]={$like:{}};_0x291axb[_0x465f[21]][_0x291axd][_0x465f[26]]=_0x465f[22]+_0x291axc+_0x465f[22];;}});Agent[_0x465f[42]](_0x291axb)[_0x465f[41]](function(_0x291ax11){var _0x291ax12=Math[_0x465f[33]](_0x291ax11[_0x465f[32]]/_0x291ax9);var _0x291ax13=_0x291ax12>(_0x291axb[_0x465f[34]]+1)?util[_0x465f[19]](_0x465f[35],_0x291ax5[_0x465f[36]],_0x291ax5[_0x465f[38]][_0x465f[37]],_0x291ax5[_0x465f[39]],_0x291axa+1):null;var _0x291ax14=_0x291axa>0?util[_0x465f[19]](_0x465f[35],_0x291ax5[_0x465f[36]],_0x291ax5[_0x465f[38]][_0x465f[37]],_0x291ax5[_0x465f[39]],_0x291axa-1):null;_0x291ax6[_0x465f[30]](200)[_0x465f[29]]({count:_0x291ax11[_0x465f[32]],rows:_0x291ax11[_0x465f[40]],next_page:_0x291ax13,previous_page:_0x291ax14,total_pages:_0x291ax12});})[_0x465f[31]](function(_0x291ax10){_0x291ax6[_0x465f[30]](500)[_0x465f[29]]({error:_0x465f[28]})});};exports[_0x465f[43]]=function(_0x291ax5,_0x291ax6){Agent[_0x465f[47]](_0x291ax5[_0x465f[46]][_0x465f[45]])[_0x465f[41]](function(_0x291ax15){if(!_0x291ax15){return _0x291ax6[_0x465f[44]](404)};return _0x291ax6[_0x465f[29]](_0x291ax15);})[_0x465f[31]](function(_0x291ax10){return handleError(_0x291ax6,_0x291ax10)})};exports[_0x465f[48]]=function(_0x291ax5,_0x291ax6){Agent[_0x465f[51]]({where:{internal:_0x291ax5[_0x465f[50]][_0x465f[49]]}})[_0x465f[41]](function(_0x291ax16){if(!_0x291ax16){return _0x291ax6[_0x465f[44]](404)};return _0x291ax6[_0x465f[29]](_0x291ax16);})[_0x465f[31]](function(_0x291ax10){return handleError(_0x291ax6,_0x291ax10)})};exports[_0x465f[52]]=function(_0x291ax5,_0x291ax6){Agent[_0x465f[52]](_0x291ax5[_0x465f[50]])[_0x465f[41]](function(_0x291ax15){Team[_0x465f[55]]({where:{defaultEntry:true}})[_0x465f[41]](function(_0x291ax17){_0x291ax17[_0x465f[54]](_0x291ax15[_0x465f[45]])[_0x465f[41]](function(){return _0x291ax6[_0x465f[30]](201)[_0x465f[29]](_0x291ax15)})[_0x465f[31]](function(_0x291ax10){console[_0x465f[53]](_0x291ax10);return handleError(_0x291ax6,_0x291ax10);})})[_0x465f[31]](function(_0x291ax10){console[_0x465f[53]](_0x291ax10);return handleError(_0x291ax6,_0x291ax10);})})[_0x465f[31]](function(_0x291ax10){console[_0x465f[53]](_0x291ax10);return handleError(_0x291ax6,_0x291ax10);})};exports[_0x465f[56]]=function(_0x291ax5,_0x291ax6){if(_0x291ax5[_0x465f[50]][_0x465f[45]]){delete _0x291ax5[_0x465f[50]][_0x465f[45]]};Agent[_0x465f[47]](_0x291ax5[_0x465f[46]][_0x465f[45]])[_0x465f[41]](function(_0x291ax15){if(!_0x291ax15){return _0x291ax6[_0x465f[44]](404)};var _0x291ax18=_[_0x465f[57]](_0x291ax15,_0x291ax5[_0x465f[50]]);_0x291ax18[_0x465f[58]]()[_0x465f[41]](function(){return _0x291ax6[_0x465f[30]](200)[_0x465f[29]](_0x291ax15)})[_0x465f[31]](function(_0x291ax10){return handleError(_0x291ax6,_0x291ax10)});})[_0x465f[31]](function(_0x291ax10){return handleError(_0x291ax6,_0x291ax10)});};exports[_0x465f[59]]=function(_0x291ax5,_0x291ax6){Agent[_0x465f[47]](_0x291ax5[_0x465f[46]][_0x465f[45]])[_0x465f[41]](function(_0x291ax15){if(!_0x291ax15){return _0x291ax6[_0x465f[44]](404)};_0x291ax15[_0x465f[59]]()[_0x465f[41]](function(){return _0x291ax6[_0x465f[44]](204)})[_0x465f[31]](function(_0x291ax10){return handleError(_0x291ax6,_0x291ax10)});})[_0x465f[31]](function(_0x291ax10){return handleError(_0x291ax6,_0x291ax10)})};exports[_0x465f[60]]=function(_0x291ax5,_0x291ax6){Agent[_0x465f[59]]({where:{id:_0x291ax5[_0x465f[11]][_0x465f[45]]},individualHooks:true})[_0x465f[41]](function(){return _0x291ax6[_0x465f[44]](204)})[_0x465f[31]](function(_0x291ax10){return handleError(_0x291ax6,_0x291ax10)})};exports[_0x465f[61]]=function(_0x291ax5,_0x291ax6,_0x291ax7){console[_0x465f[53]](_0x291ax5[_0x465f[50]]);var _0x291ax19=_0x291ax5[_0x465f[62]][_0x465f[45]];var _0x291ax1a=String(_0x291ax5[_0x465f[50]][_0x465f[63]]);var _0x291ax1b=String(_0x291ax5[_0x465f[50]][_0x465f[64]]);Agent[_0x465f[47]](_0x291ax19)[_0x465f[41]](function(_0x291ax15){if(_0x291ax15[_0x465f[65]](_0x291ax1a)){_0x291ax15[_0x465f[66]]=_0x291ax1b;_0x291ax15[_0x465f[58]]()[_0x465f[41]](function(){_0x291ax6[_0x465f[30]](200)[_0x465f[29]](_0x291ax15)})[_0x465f[31]](function(_0x291ax10){return _0x291ax7(_0x291ax10)});}else {_0x291ax6[_0x465f[44]](403)}});};exports[_0x465f[67]]=function(_0x291ax5,_0x291ax6,_0x291ax7){var _0x291ax1b=String(_0x291ax5[_0x465f[50]][_0x465f[64]]);Agent[_0x465f[47]](_0x291ax5[_0x465f[46]][_0x465f[45]])[_0x465f[41]](function(_0x291ax1c){_0x291ax1c[_0x465f[66]]=_0x291ax1b;_0x291ax1c[_0x465f[58]]()[_0x465f[41]](function(){_0x291ax6[_0x465f[30]](200)[_0x465f[29]](_0x291ax1c)})[_0x465f[31]](function(_0x291ax10){return handleError(_0x291ax6,_0x291ax10)});});};exports[_0x465f[68]]=function(_0x291ax5,_0x291ax6){var _0x291ax1d={};_0x291ax1d[_0x291ax5[_0x465f[46]][_0x465f[69]]]=_0x291ax5[_0x465f[50]][_0x465f[70]];Agent[_0x465f[42]]({where:_0x291ax1d})[_0x465f[41]](function(_0x291ax11){if(_0x291ax11[_0x465f[32]]){return _0x291ax6[_0x465f[30]](200)[_0x465f[29]]({isValid:false,value:_0x291ax5[_0x465f[50]][_0x465f[70]]})};return _0x291ax6[_0x465f[30]](200)[_0x465f[29]]({isValid:true,value:_0x291ax5[_0x465f[50]][_0x465f[70]]});})[_0x465f[31]](function(_0x291ax10){return handleError(_0x291ax6,_0x291ax10)});};function handleError(_0x291ax6,_0x291ax10){return _0x291ax6[_0x465f[30]](500)[_0x465f[29]](_0x291ax10)}