Built motion from commit afd017d.|0.0.28
[motion.git] / server / api / voice_queue / voice_queue.controller.js
1 var _0xad80=["\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","\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x55\x73\x65\x72\x48\x61\x73\x56\x6F\x69\x63\x65\x51\x75\x65\x75\x65","\x56\x6F\x69\x63\x65\x45\x78\x74\x65\x6E\x73\x69\x6F\x6E","\x69\x6E\x64\x65\x78","\x6E\x61\x6D\x65","\x64\x65\x73\x63\x72\x69\x70\x74\x69\x6F\x6E","\x73\x74\x72\x61\x74\x65\x67\x79","\x63\x6F\x6E\x74\x65\x78\x74","\x70\x65\x72\x5F\x70\x61\x67\x65","\x71\x75\x65\x72\x79","\x70\x61\x67\x65","\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","\x63\x61\x74\x63\x68","\x63\x6F\x75\x6E\x74","\x6C\x6F\x67","\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","\x73\x65\x6E\x64","\x73\x74\x61\x74\x75\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","\x71\x75\x65\x75\x65\x56\x61\x6C\x69\x64\x61\x74\x69\x6F\x6E","\x62\x6F\x64\x79","\x66\x69\x6E\x64\x41\x6C\x6C","\x63\x72\x65\x61\x74\x65","\x46\x69\x6E\x64\x69\x6E\x67\x20\x61\x70\x70\x20\x72\x6F\x77\x2E\x2E\x2E\x2E\x2E","\x6C\x65\x6E\x67\x74\x68","\x4D\x45\x53\x53\x41\x47\x45\x5F\x45\x58\x49\x53\x54\x5F\x51\x55\x45\x55\x45","\x75\x70\x64\x61\x74\x65","\x6D\x65\x72\x67\x65","\x73\x61\x76\x65","\x66\x69\x6E\x64","\x61\x64\x64\x41\x67\x65\x6E\x74\x73","\x53\x49\x50\x2F\x25\x73","\x6D\x61\x70","\x62\x75\x6C\x6B\x43\x72\x65\x61\x74\x65","\x61\x67\x65\x6E\x74\x73","\x72\x65\x6D\x6F\x76\x65\x41\x67\x65\x6E\x74\x73","\x72\x65\x6D\x6F\x76\x65\x55\x73\x65\x72\x73","\x6E\x6F\x20\x6D\x61\x69\x6C\x20\x71\x75\x65\x75\x65\x20\x66\x6F\x75\x6E\x64","\x64\x65\x73\x74\x72\x6F\x79","\x4D\x45\x53\x53\x41\x47\x45\x5F\x51\x55\x45\x55\x45\x5F\x52\x4F\x55\x54\x45\x5F\x41\x53\x53\x4F\x43\x49\x41\x54\x45\x44","\x62\x75\x6C\x6B\x44\x65\x73\x74\x72\x6F\x79","\x64\x61\x74\x61\x56\x61\x6C\x75\x65\x73","\x70\x6C\x75\x63\x6B"];_0xad80[0];var _=require(_0xad80[1]);var util=require(_0xad80[2]);var User=require(_0xad80[4])[_0xad80[3]];var VoiceQueue=require(_0xad80[4])[_0xad80[5]];var UserHasVoiceQueue=require(_0xad80[4])[_0xad80[6]];var VoiceExtension=require(_0xad80[4])[_0xad80[7]];exports[_0xad80[8]]=function(_0xde9dx7,_0xde9dx8){var _0xde9dx9=[_0xad80[9],_0xad80[10],_0xad80[11],_0xad80[12]];var _0xde9dxa=_0xde9dx7[_0xad80[14]][_0xad80[13]]?parseInt(_0xde9dx7[_0xad80[14]][_0xad80[13]],10):100;var _0xde9dxb=_0xde9dx7[_0xad80[14]][_0xad80[15]]?parseInt(_0xde9dx7[_0xad80[14]][_0xad80[15]],10):0;var _0xde9dxc={where:{},limit:_0xde9dxa,offset:_0xde9dxb*_0xde9dxa};_[_0xad80[29]](_0xde9dx7[_0xad80[14]],function(_0xde9dxd,_0xde9dxe){switch(_0xde9dxe){case _0xad80[13]:;case _0xad80[15]:break ;;case _0xad80[18]:_0xde9dxc[_0xad80[16]]=util[_0xad80[21]](_0xad80[17],_0xde9dx7[_0xad80[14]][_0xad80[18]],_0xde9dx7[_0xad80[14]][_0xad80[19]]||_0xad80[20])||null;break ;;case _0xad80[19]:break ;;case _0xad80[27]:_0xde9dxc[_0xad80[23]][_0xad80[22]]=[];_0xde9dx9[_0xad80[26]](function(_0xde9dxf){var _0xde9dx10={};_0xde9dx10[_0xde9dxf]={$like:_0xad80[24]+_0xde9dxd+_0xad80[24]};_0xde9dxc[_0xad80[23]][_0xad80[22]][_0xad80[25]](_0xde9dx10);});break ;;default:_0xde9dxc[_0xad80[23]][_0xde9dxe]={$like:{}};_0xde9dxc[_0xad80[23]][_0xde9dxe][_0xad80[28]]=_0xad80[24]+_0xde9dxd+_0xad80[24];;}});VoiceQueue[_0xad80[44]](_0xde9dxc)[_0xad80[43]](function(_0xde9dx12){console[_0xad80[32]](_0xde9dx12[_0xad80[31]]);var _0xde9dx13=Math[_0xad80[33]](_0xde9dx12[_0xad80[31]]/_0xde9dxa);console[_0xad80[32]](_0xde9dx13);var _0xde9dx14=_0xde9dx13>(_0xde9dxc[_0xad80[34]]+1)?util[_0xad80[21]](_0xad80[35],_0xde9dx7[_0xad80[36]],_0xde9dx7[_0xad80[38]][_0xad80[37]],_0xde9dx7[_0xad80[39]],_0xde9dxb+1):null;var _0xde9dx15=_0xde9dxb>0?util[_0xad80[21]](_0xad80[35],_0xde9dx7[_0xad80[36]],_0xde9dx7[_0xad80[38]][_0xad80[37]],_0xde9dx7[_0xad80[39]],_0xde9dxb-1):null;_0xde9dx8[_0xad80[42]](200)[_0xad80[41]]({count:_0xde9dx12[_0xad80[31]],rows:_0xde9dx12[_0xad80[40]],next_page:_0xde9dx14,previous_page:_0xde9dx15,total_pages:_0xde9dx13});})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)});};exports[_0xad80[45]]=function(_0xde9dx7,_0xde9dx8){VoiceQueue[_0xad80[49]](_0xde9dx7[_0xad80[48]][_0xad80[47]])[_0xad80[43]](function(_0xde9dx16){if(!_0xde9dx16){return _0xde9dx8[_0xad80[46]](404)};return _0xde9dx8[_0xad80[41]](_0xde9dx16);})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)})};exports[_0xad80[50]]=function(_0xde9dx7,_0xde9dx8){console[_0xad80[32]](_0xde9dx7[_0xad80[51]]);VoiceQueue[_0xad80[52]]({where:{name:_0xde9dx7[_0xad80[51]][_0xad80[9]]}})[_0xad80[43]](function(_0xde9dx16){if(!_0xde9dx16){return _0xde9dx8[_0xad80[46]](404)};return _0xde9dx8[_0xad80[41]](_0xde9dx16);})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)});};exports[_0xad80[53]]=function(_0xde9dx7,_0xde9dx8){VoiceQueue[_0xad80[52]]({where:{name:_0xde9dx7[_0xad80[51]][_0xad80[9]]}})[_0xad80[43]](function(_0xde9dx17){console[_0xad80[32]](_0xde9dx17);console[_0xad80[32]](_0xad80[54]);if(!_0xde9dx17){return _0xde9dx8[_0xad80[46]](404)};if(_0xde9dx17[_0xad80[55]]>0){return _0xde9dx8[_0xad80[42]](500)[_0xad80[41]]({message:_0xad80[56]})};VoiceQueue[_0xad80[53]](_0xde9dx7[_0xad80[51]])[_0xad80[43]](function(_0xde9dx16){return _0xde9dx8[_0xad80[42]](201)[_0xad80[41]](_0xde9dx16)})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)});})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)})};exports[_0xad80[57]]=function(_0xde9dx7,_0xde9dx8){VoiceQueue[_0xad80[60]]({where:{name:_0xde9dx7[_0xad80[48]][_0xad80[47]]}})[_0xad80[43]](function(_0xde9dx18){if(!_0xde9dx18){return _0xde9dx8[_0xad80[46]](404)};if(_0xde9dx7[_0xad80[51]][_0xad80[47]]){delete _0xde9dx7[_0xad80[51]][_0xad80[47]]};var _0xde9dx19=_[_0xad80[58]](_0xde9dx18,_0xde9dx7[_0xad80[51]]);_0xde9dx19[_0xad80[59]]()[_0xad80[43]](function(){return _0xde9dx8[_0xad80[42]](200)[_0xad80[41]](_0xde9dx18)})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)});})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)})};exports[_0xad80[61]]=function(_0xde9dx7,_0xde9dx8,_0xde9dx1a){console[_0xad80[32]](_0xad80[61]);console[_0xad80[32]](_0xde9dx7[_0xad80[48]]);console[_0xad80[32]](_0xde9dx7[_0xad80[51]]);User[_0xad80[52]]({where:{id:{$in:_0xde9dx7[_0xad80[51]][_0xad80[65]]}}})[_0xad80[43]](function(_0xde9dx1b){var _0xde9dx1c=_[_0xad80[63]](_0xde9dx1b,function(_0xde9dx1d){return {queue:_0xde9dx7[_0xad80[48]][_0xad80[47]],location:util[_0xad80[21]](_0xad80[62],_0xde9dx1d[_0xad80[9]]),membername:_0xde9dx1d[_0xad80[9]],VoiceQueueName:_0xde9dx7[_0xad80[48]][_0xad80[47]],UserId:_0xde9dx1d[_0xad80[47]]}});UserHasVoiceQueue[_0xad80[64]](_0xde9dx1c,{individualHooks:true})[_0xad80[43]](function(){return _0xde9dx8[_0xad80[46]](200)})[_0xad80[30]](function(_0xde9dx11){return _0xde9dx1a(_0xde9dx11)});})[_0xad80[30]](function(_0xde9dx11){return _0xde9dx1a(_0xde9dx11)});};exports[_0xad80[66]]=function(_0xde9dx7,_0xde9dx8,_0xde9dx1a){VoiceQueue[_0xad80[60]]({where:{name:_0xde9dx7[_0xad80[48]][_0xad80[47]]}})[_0xad80[43]](function(_0xde9dx18){if(_0xde9dx18){_0xde9dx18[_0xad80[67]](_0xde9dx7[_0xad80[51]][_0xad80[65]],{individualHooks:true})[_0xad80[43]](function(){return _0xde9dx8[_0xad80[46]](200)})[_0xad80[30]](function(_0xde9dx11){return _0xde9dx1a(_0xde9dx11)})}else {return _0xde9dx1a( new Error(_0xad80[68]))}})[_0xad80[30]](function(_0xde9dx11){return _0xde9dx1a(_0xde9dx11)})};exports[_0xad80[69]]=function(_0xde9dx7,_0xde9dx8){VoiceQueue[_0xad80[60]]({where:{name:_0xde9dx7[_0xad80[48]][_0xad80[9]]}})[_0xad80[43]](function(_0xde9dx16){if(!_0xde9dx16){return _0xde9dx8[_0xad80[46]](404)};VoiceExtension[_0xad80[52]]({where:{queue:_0xde9dx16[_0xad80[9]]}})[_0xad80[43]](function(_0xde9dx1e){if(_0xde9dx1e[_0xad80[55]]>0){return _0xde9dx8[_0xad80[42]](500)[_0xad80[41]]({message:_0xad80[70]})};_0xde9dx16[_0xad80[69]]()[_0xad80[43]](function(){return _0xde9dx8[_0xad80[46]](204)})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)});})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)});})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)})};exports[_0xad80[71]]=function(_0xde9dx7,_0xde9dx8){VoiceQueue[_0xad80[52]]({where:{name:_0xde9dx7[_0xad80[14]][_0xad80[9]]}})[_0xad80[43]](function(_0xde9dx1f){if(!_0xde9dx1f){return _0xde9dx8[_0xad80[46]](404)};var _0xde9dx20=_[_0xad80[73]](_[_0xad80[73]](_0xde9dx1f,_0xad80[72]),_0xad80[9]);console[_0xad80[32]](_0xde9dx20);VoiceExtension[_0xad80[52]]({where:{queue:_0xde9dx20}})[_0xad80[43]](function(_0xde9dx1e){if(_0xde9dx1e[_0xad80[55]]>0){return _0xde9dx8[_0xad80[42]](500)[_0xad80[41]]({message:_0xad80[70]})};VoiceQueue[_0xad80[69]]({where:{name:_0xde9dx7[_0xad80[14]][_0xad80[9]]},individualHooks:true})[_0xad80[43]](function(){return _0xde9dx8[_0xad80[46]](204)})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)});})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)});})[_0xad80[30]](function(_0xde9dx11){return handleError(_0xde9dx8,_0xde9dx11)})};function handleError(_0xde9dx8,_0xde9dx11){return _0xde9dx8[_0xad80[42]](500)[_0xad80[41]](_0xde9dx11)}